功課至上

Thursday, January 11, 2007

牛頓法開平方

前言

以前上大一上微積分的時候,老師曾經提過牛頓法,這是一個運用泰勒展開式來求取近似值的方法,我想說如果運用matlab,就可以直接寫程式來計算開方的近似值,這似乎也是計算機計算的原理,算的上是運用的一環。


背景說明
牛頓法(Newton's method)又稱為牛頓-拉夫遜方法(Newton-Raphson method),它是一種在實數域和複數域上近似求解方程的方法,利用函數f(x)的泰勒級數的前面幾項來尋找方程式f(x) = 0的根。首先,選擇一個接近函數f(x)零點的x0,計算相應的f(x0)和切線斜率f'(x0) (這裡f'表示函數f的導數),然後我們計算穿過點(x0,f(x0))並且斜率為f'(x0)的直線和x軸的交點的x坐標, 也就是求如下方程的解:



我們將新求得的點的x坐標命名為x1,通常x1會比x0更接近方程f(x) = 0的解,因此我們現在可以利用x1開始下一輪計算。計算公式可化簡為如下所示:






程式內容:
------------------------------------------------------------------------------------------
%newton2.m
x=input('請輸入一整數值:'); % 輸入一整數
if x>0
delta = 0.001;% set convergence tolerance=0.001
r=1;rold=2;% 設r和rold的初始值
it=0;%設定計數
maxit=30;%設定最大計數次數
while abs(rold-r)> delta & itrold = r;%save old value for convergence test
r =0.5*(rold + x/rold);%牛頓近似式
it = it + 1;
if abs(rold-r)< delta%當abs(rold-r)< delta 則跳出程式,不再計算
break;
end
end
else
fprintf('你輸入的數非正整數!');
return; %當輸入負數,則return to calling function
end
fprintf('\n %d^(1/2)=%g,共計數=%d次',x,r,it);
------------------------------------------------------------------------------------------
執行結果

>> new請輸入一整數值:456

456^(1/2)=21.3542,共計數=8次

>>

利用溫度與濕度得知今天是否適合活動

前言:
以前當兵的時後只要溫度高於攝氏35度,人員就禁止在外出操,在32到35度之間則是在陰影下上課,32度就正常出操,至於溼度則有溼度計量測,過濕ㄧ般來說也不會出操,可是濕度跟溫度還要查表然後再看是不是符合出操的規定,畢竟國軍號稱是一切照規定來的地方,這邊我想就利用matlab的功能直接寫個小程式來取代查表,也比較省時省力。

溫度過高會造成什麼樣的後果:
高溫加上悶熱,很容易造成脫水,高溫悶熱會使得人體中樞負責調控的下視丘失去功能,造成體內溫度上升。下視丘失去調控體內溫度的功能後,體溫會開始上升,影響腦部,造成人會昏睡,例如在大太陽底下出操或運動、在密閉不通風的房間內活動,都有可能造成體內溫度升高、脫水,造成意識昏迷,高溫悶熱也會引發橫紋肌溶解症,造成腎功能衰竭,病人也會沒有小便,必須洗腎治療。醫生建議,體溫升高、昏迷的民眾,應趕緊由其他人幫助,移到陰涼處,使用電風扇、冷氣或冰敷,降低體溫,並補充水分,或以點滴補充體液。

資料來源:
來源網站http://www.wanfangdata.com.cn/qikan/periodical.Articles/gxqx/gxqx99/gxqx9903/990316.htm由於關於人體舒適指數的資料很多,所以我採用Er為溫濕指數(也稱不適指數),計算公式是Er=T-0.55(1-r)(58-T)℃,計算出來的值由以下來資料決定Er≤2.5,寒冷,感覺極不舒適;必須採取保溫措施。2.5≤Er≤9,冷,大部分 感覺不舒適;要採取保溫措施。9≤Er≤12.5,涼,少部分人感覺不舒適;適當採取保溫措施。12.5≤Er≤22.5,熱舒適,大部分人感覺舒適;22.5≤Er≤25.5,偏熱,少部分人感覺不舒適;適當採取降溫措施。25.5≤Er≤28,熱,大部分人感覺不舒適;要採取降溫措施。Er≥28:r<60%,炎熱,感覺很不舒適;應當採取降溫措施。


指令:

指令:一開始我寫了一個比較簡單的敘述檔案
------------------------------------------------------------------------------------------------
function [A]=Er(d,r)% d攝氏溫度,r相對溼度 ,Er(溫濕指數)
A=d-0.55*(1-r/100)*(58-d)
if 22.5<=A & A<25.5
fprintf('Er=%0.2f 偏熱,少部份人感覺不舒適,需採適當降溫措施\n',A)
elseif 12.5<=A & A<22.5
fprintf('Er=%0.2f 舒適,大部分人感覺舒適\n',A)
elseif 9<=A & A<12.5
fprintf('Er=%0.2f 涼,少部分人感覺不舒適,須採取適當保暖措施\n',A)
elseif 2<=A & A<9
fprintf('Er=%0.2f 冷,大部分人感覺不舒適,需採取適當保暖措施\n',A)
elseif A<2
fprintf('Er=%0.2f 寒冷,大部分人感覺極不舒適,需採取適當保暖措施,避免室外活動\n',A)
elseif 25.5<=A & A<28
fprintf('Er=%0.2f 熱,大部分人感覺很不舒適,需採取適當降溫措施\n',A)
else
fprintf('Er=%0.2f 炎熱,大部分人感覺極不舒適,避免室外活動\n',A)
end模擬輸出結果:>> [A]=Er(35,25)
A =
25.5125
Er=25.51 熱,大部分人感覺很不舒適,需採取適當降溫措施
------------------------------------------------------------------------------------------------
由上述程式可以很快得出答案,但是,介面並不是很和善,輸入值也未說明,為了讓使用者更能清楚地了解應該輸入的內容,因此我又改寫成另一個函數檔(function file),如下

------------------------------------------------------------------------------------------------
% Er2.m
%Er(人體舒適指數或溫濕指數)
d=input('請鍵入溫度 (攝氏)');
if isnumeric(d)
r=input('請鍵入相對溼度 (%)');
A=d-0.55*(1-r/100)*(58-d)%A=Er(人體舒適指數)
if 22.5<=A & A<25.5
fprintf('Er=%0.2f 偏熱,少部份人感覺不舒適,需採適當降溫措施\n',A)
elseif 12.5<=A & A<22.5
fprintf('Er=%0.2f 舒適,大部分人感覺舒適\n',A)
elseif 9<=A & A<12.5
fprintf('Er=%0.2f 涼,少部分人感覺不舒適,須採取適當保暖措施\n',A)
elseif 2<=A & A<9
fprintf('Er=%0.2f 冷,大部分人感覺不舒適,需採取適當保暖措施\n',A)
elseif A<2
fprintf('Er=%0.2f 寒冷,大部分人感覺極不舒適,需採取適當保暖措施,避免室外活動\n',A)
elseif 25.5<=A & A<28
fprintf('Er=%0.2f 熱,大部分人感覺很不舒適,需採取適當降溫措施\n',A)
else
fprintf('Er=%0.2f 炎熱,大部分人感覺極不舒適,避免室外活動\n',A)
end
end模擬輸出結果:>> er2
請鍵入溫度 (攝氏)35
請鍵入相對溼度 (%)25
A =
25.5125
Er=25.51 熱,大部分人感覺很不舒適,需採取適當降溫措施
>>
------------------------------------------------------------------------------------------------
結果同上


結論:

第二版的程式不但更多了交談功能,可以更清楚知道輸入的單位為何,這樣介面不但比較和善,對於使用者也比較不會搞混應該輸入的單位。

Thursday, December 14, 2006

12月15日上課筆記

>> [x',y']
ans =
0 0 1.0000 0.8415 2.0000 0.9093 3.0000 0.1411 4.0000 -0.7568 5.0000 -0.9589 6.0000 -0.2794 7.0000 0.6570 8.0000 0.9894 9.0000 0.4121 10.0000 -0.5440
>> y1=interp1(x,y,4.5)
y1 =
-0.8579
>> y1=interp1(x,y,0.8)
y1 =
0.6732
>> x1=interp1(y,x,0.8)
x1 =
2.3496
>> y1=interp1(x,y,1)
y1 =
0.8415



查表用的

Friday, December 01, 2006

作業9.1

我發現若要純繪圖,則使用line()指令較為方便,而且同一個圖可以執行多次線段之繪製,而plot則是一次一圖,要繪重疊圖必須配合hold on指令,雖然說它們都可以同時執行多線段的繪圖。

例如
x=linspace(1,5,50);
y1=line(x,x.^2);
y2=line(x,x.^3);








左圖是y1的圖
右圖是直接執行y2的圖
我們可以發現 同一個圖可
以執行多次繪圖

x=linspace(1,5,50);
y1=plot(x,x.^2)
y2=plot(x,x.^3)



左邊是執行y1的圖
右邊是執行y1後再執行y2的圖
我們可以發現plot並不支持同一個圖執行多次線段之繪製
這就是我所發現不同之處

Friday, November 10, 2006

執行流程四

>> b-eix

ans =

Columns 1 through 11

0 0 0 0 0 0 0 0 0 0 0

Columns 12 through 22

0 0 0 0 0 0 0 0 0 0 0

Columns 23 through 33

0 0 0 0 0 0 0 0 0 0 0

Columns 34 through 44

0 0 0 0 0 0 0 0 0 0 0

Columns 45 through 55

0 0 0 0 0 0 0 0 0 0 0

Columns 56 through 66

0 0 0 0 0 0 0 0 0 0 0

Columns 67 through 77

0 0 0 0 0 0 0 0 0 0 0

Columns 78 through 88

0 0 0 0 0 0 0 0 0 0 0

Columns 89 through 99

0 0 0 0 0 0 0 0 0 0 0

Columns 100 through 110

0 0 0 0 0 0 0 0 0 0 0

Columns 111 through 121

0 0 0 0 0 0 0 0 0 0 0

Columns 122 through 132

0 0 0 0 0 0 0 0 0 0 0

Columns 133 through 143

0 0 0 0 0 0 0 0 0 0 0

Columns 144 through 154

0 0 0 0 0 0 0 0 0 0 0

Columns 155 through 165

0 0 0 0 0 0 0 0 0 0 0

Columns 166 through 176

0 0 0 0 0 0 0 0 0 0 0

Columns 177 through 187

0 0 0 0 0 0 0 0 0 0 0

Columns 188 through 198

0 0 0 0 0 0 0 0 0 0 0

Columns 199 through 209

0 0 0 0 0 0 0 0 0 0 0

Columns 210 through 220

0 0 0 0 0 0 0 0 0 0 0

Columns 221 through 231

0 0 0 0 0 0 0 0 0 0 0

Columns 232 through 242

0 0 0 0 0 0 0 0 0 0 0

Columns 243 through 253

0 0 0 0 0 0 0 0 0 0 0

Columns 254 through 264

0 0 0 0 0 0 0 0 0 0 0

Columns 265 through 275

0 0 0 0 0 0 0 0 0 0 0

Columns 276 through 286

0 0 0 0 0 0 0 0 0 0 0

Columns 287 through 297

0 0 0 0 0 0 0 0 0 0 0

Columns 298 through 308

0 0 0 0 0 0 0 0 0 0 0

Columns 309 through 319

0 0 0 0 0 0 0 0 0 0 0

Columns 320 through 330

0 0 0 0 0 0 0 0 0 0 0

Columns 331 through 341

0 0 0 0 0 0 0 0 0 0 0

Columns 342 through 352

0 0 0 0 0 0 0 0 0 0 0

Columns 353 through 361

0 0 0 0 0 0 0 0 0

執行流程三

>> b=cos(theta)+i*sin(theta)

b =

Columns 1 through 3

1.0000 0.9998 + 0.0175i 0.9994 + 0.0349i

Columns 4 through 6

0.9986 + 0.0523i 0.9976 + 0.0698i 0.9962 + 0.0872i

Columns 7 through 9

0.9945 + 0.1045i 0.9925 + 0.1219i 0.9903 + 0.1392i

Columns 10 through 12

0.9877 + 0.1564i 0.9848 + 0.1736i 0.9816 + 0.1908i

Columns 13 through 15

0.9781 + 0.2079i 0.9744 + 0.2250i 0.9703 + 0.2419i

Columns 16 through 18

0.9659 + 0.2588i 0.9613 + 0.2756i 0.9563 + 0.2924i

Columns 19 through 21

0.9511 + 0.3090i 0.9455 + 0.3256i 0.9397 + 0.3420i

Columns 22 through 24

0.9336 + 0.3584i 0.9272 + 0.3746i 0.9205 + 0.3907i

Columns 25 through 27

0.9135 + 0.4067i 0.9063 + 0.4226i 0.8988 + 0.4384i

Columns 28 through 30

0.8910 + 0.4540i 0.8829 + 0.4695i 0.8746 + 0.4848i

Columns 31 through 33

0.8660 + 0.5000i 0.8572 + 0.5150i 0.8480 + 0.5299i

Columns 34 through 36

0.8387 + 0.5446i 0.8290 + 0.5592i 0.8192 + 0.5736i

Columns 37 through 39

0.8090 + 0.5878i 0.7986 + 0.6018i 0.7880 + 0.6157i

Columns 40 through 42

0.7771 + 0.6293i 0.7660 + 0.6428i 0.7547 + 0.6561i

Columns 43 through 45

0.7431 + 0.6691i 0.7314 + 0.6820i 0.7193 + 0.6947i

Columns 46 through 48

0.7071 + 0.7071i 0.6947 + 0.7193i 0.6820 + 0.7314i

Columns 49 through 51

0.6691 + 0.7431i 0.6561 + 0.7547i 0.6428 + 0.7660i

Columns 52 through 54

0.6293 + 0.7771i 0.6157 + 0.7880i 0.6018 + 0.7986i

Columns 55 through 57

0.5878 + 0.8090i 0.5736 + 0.8192i 0.5592 + 0.8290i

Columns 58 through 60

0.5446 + 0.8387i 0.5299 + 0.8480i 0.5150 + 0.8572i

Columns 61 through 63

0.5000 + 0.8660i 0.4848 + 0.8746i 0.4695 + 0.8829i

Columns 64 through 66

0.4540 + 0.8910i 0.4384 + 0.8988i 0.4226 + 0.9063i

Columns 67 through 69

0.4067 + 0.9135i 0.3907 + 0.9205i 0.3746 + 0.9272i

Columns 70 through 72

0.3584 + 0.9336i 0.3420 + 0.9397i 0.3256 + 0.9455i

Columns 73 through 75

0.3090 + 0.9511i 0.2924 + 0.9563i 0.2756 + 0.9613i

Columns 76 through 78

0.2588 + 0.9659i 0.2419 + 0.9703i 0.2250 + 0.9744i

Columns 79 through 81

0.2079 + 0.9781i 0.1908 + 0.9816i 0.1736 + 0.9848i

Columns 82 through 84

0.1564 + 0.9877i 0.1392 + 0.9903i 0.1219 + 0.9925i

Columns 85 through 87

0.1045 + 0.9945i 0.0872 + 0.9962i 0.0698 + 0.9976i

Columns 88 through 90

0.0523 + 0.9986i 0.0349 + 0.9994i 0.0175 + 0.9998i

Columns 91 through 93

0.0000 + 1.0000i -0.0175 + 0.9998i -0.0349 + 0.9994i

Columns 94 through 96

-0.0523 + 0.9986i -0.0698 + 0.9976i -0.0872 + 0.9962i

Columns 97 through 99

-0.1045 + 0.9945i -0.1219 + 0.9925i -0.1392 + 0.9903i

Columns 100 through 102

-0.1564 + 0.9877i -0.1736 + 0.9848i -0.1908 + 0.9816i

Columns 103 through 105

-0.2079 + 0.9781i -0.2250 + 0.9744i -0.2419 + 0.9703i

Columns 106 through 108

-0.2588 + 0.9659i -0.2756 + 0.9613i -0.2924 + 0.9563i

Columns 109 through 111

-0.3090 + 0.9511i -0.3256 + 0.9455i -0.3420 + 0.9397i

Columns 112 through 114

-0.3584 + 0.9336i -0.3746 + 0.9272i -0.3907 + 0.9205i

Columns 115 through 117

-0.4067 + 0.9135i -0.4226 + 0.9063i -0.4384 + 0.8988i

Columns 118 through 120

-0.4540 + 0.8910i -0.4695 + 0.8829i -0.4848 + 0.8746i

Columns 121 through 123

-0.5000 + 0.8660i -0.5150 + 0.8572i -0.5299 + 0.8480i

Columns 124 through 126

-0.5446 + 0.8387i -0.5592 + 0.8290i -0.5736 + 0.8192i

Columns 127 through 129

-0.5878 + 0.8090i -0.6018 + 0.7986i -0.6157 + 0.7880i

Columns 130 through 132

-0.6293 + 0.7771i -0.6428 + 0.7660i -0.6561 + 0.7547i

Columns 133 through 135

-0.6691 + 0.7431i -0.6820 + 0.7314i -0.6947 + 0.7193i

Columns 136 through 138

-0.7071 + 0.7071i -0.7193 + 0.6947i -0.7314 + 0.6820i

Columns 139 through 141

-0.7431 + 0.6691i -0.7547 + 0.6561i -0.7660 + 0.6428i

Columns 142 through 144

-0.7771 + 0.6293i -0.7880 + 0.6157i -0.7986 + 0.6018i

Columns 145 through 147

-0.8090 + 0.5878i -0.8192 + 0.5736i -0.8290 + 0.5592i

Columns 148 through 150

-0.8387 + 0.5446i -0.8480 + 0.5299i -0.8572 + 0.5150i

Columns 151 through 153

-0.8660 + 0.5000i -0.8746 + 0.4848i -0.8829 + 0.4695i

Columns 154 through 156

-0.8910 + 0.4540i -0.8988 + 0.4384i -0.9063 + 0.4226i

Columns 157 through 159

-0.9135 + 0.4067i -0.9205 + 0.3907i -0.9272 + 0.3746i

Columns 160 through 162

-0.9336 + 0.3584i -0.9397 + 0.3420i -0.9455 + 0.3256i

Columns 163 through 165

-0.9511 + 0.3090i -0.9563 + 0.2924i -0.9613 + 0.2756i

Columns 166 through 168

-0.9659 + 0.2588i -0.9703 + 0.2419i -0.9744 + 0.2250i

Columns 169 through 171

-0.9781 + 0.2079i -0.9816 + 0.1908i -0.9848 + 0.1736i

Columns 172 through 174

-0.9877 + 0.1564i -0.9903 + 0.1392i -0.9925 + 0.1219i

Columns 175 through 177

-0.9945 + 0.1045i -0.9962 + 0.0872i -0.9976 + 0.0698i

Columns 178 through 180

-0.9986 + 0.0523i -0.9994 + 0.0349i -0.9998 + 0.0175i

Columns 181 through 183

-1.0000 + 0.0000i -0.9998 - 0.0175i -0.9994 - 0.0349i

Columns 184 through 186

-0.9986 - 0.0523i -0.9976 - 0.0698i -0.9962 - 0.0872i

Columns 187 through 189

-0.9945 - 0.1045i -0.9925 - 0.1219i -0.9903 - 0.1392i

Columns 190 through 192

-0.9877 - 0.1564i -0.9848 - 0.1736i -0.9816 - 0.1908i

Columns 193 through 195

-0.9781 - 0.2079i -0.9744 - 0.2250i -0.9703 - 0.2419i

Columns 196 through 198

-0.9659 - 0.2588i -0.9613 - 0.2756i -0.9563 - 0.2924i

Columns 199 through 201

-0.9511 - 0.3090i -0.9455 - 0.3256i -0.9397 - 0.3420i

Columns 202 through 204

-0.9336 - 0.3584i -0.9272 - 0.3746i -0.9205 - 0.3907i

Columns 205 through 207

-0.9135 - 0.4067i -0.9063 - 0.4226i -0.8988 - 0.4384i

Columns 208 through 210

-0.8910 - 0.4540i -0.8829 - 0.4695i -0.8746 - 0.4848i

Columns 211 through 213

-0.8660 - 0.5000i -0.8572 - 0.5150i -0.8480 - 0.5299i

Columns 214 through 216

-0.8387 - 0.5446i -0.8290 - 0.5592i -0.8192 - 0.5736i

Columns 217 through 219

-0.8090 - 0.5878i -0.7986 - 0.6018i -0.7880 - 0.6157i

Columns 220 through 222

-0.7771 - 0.6293i -0.7660 - 0.6428i -0.7547 - 0.6561i

Columns 223 through 225

-0.7431 - 0.6691i -0.7314 - 0.6820i -0.7193 - 0.6947i

Columns 226 through 228

-0.7071 - 0.7071i -0.6947 - 0.7193i -0.6820 - 0.7314i

Columns 229 through 231

-0.6691 - 0.7431i -0.6561 - 0.7547i -0.6428 - 0.7660i

Columns 232 through 234

-0.6293 - 0.7771i -0.6157 - 0.7880i -0.6018 - 0.7986i

Columns 235 through 237

-0.5878 - 0.8090i -0.5736 - 0.8192i -0.5592 - 0.8290i

Columns 238 through 240

-0.5446 - 0.8387i -0.5299 - 0.8480i -0.5150 - 0.8572i

Columns 241 through 243

-0.5000 - 0.8660i -0.4848 - 0.8746i -0.4695 - 0.8829i

Columns 244 through 246

-0.4540 - 0.8910i -0.4384 - 0.8988i -0.4226 - 0.9063i

Columns 247 through 249

-0.4067 - 0.9135i -0.3907 - 0.9205i -0.3746 - 0.9272i

Columns 250 through 252

-0.3584 - 0.9336i -0.3420 - 0.9397i -0.3256 - 0.9455i

Columns 253 through 255

-0.3090 - 0.9511i -0.2924 - 0.9563i -0.2756 - 0.9613i

Columns 256 through 258

-0.2588 - 0.9659i -0.2419 - 0.9703i -0.2250 - 0.9744i

Columns 259 through 261

-0.2079 - 0.9781i -0.1908 - 0.9816i -0.1736 - 0.9848i

Columns 262 through 264

-0.1564 - 0.9877i -0.1392 - 0.9903i -0.1219 - 0.9925i

Columns 265 through 267

-0.1045 - 0.9945i -0.0872 - 0.9962i -0.0698 - 0.9976i

Columns 268 through 270

-0.0523 - 0.9986i -0.0349 - 0.9994i -0.0175 - 0.9998i

Columns 271 through 273

-0.0000 - 1.0000i 0.0175 - 0.9998i 0.0349 - 0.9994i

Columns 274 through 276

0.0523 - 0.9986i 0.0698 - 0.9976i 0.0872 - 0.9962i

Columns 277 through 279

0.1045 - 0.9945i 0.1219 - 0.9925i 0.1392 - 0.9903i

Columns 280 through 282

0.1564 - 0.9877i 0.1736 - 0.9848i 0.1908 - 0.9816i

Columns 283 through 285

0.2079 - 0.9781i 0.2250 - 0.9744i 0.2419 - 0.9703i

Columns 286 through 288

0.2588 - 0.9659i 0.2756 - 0.9613i 0.2924 - 0.9563i

Columns 289 through 291

0.3090 - 0.9511i 0.3256 - 0.9455i 0.3420 - 0.9397i

Columns 292 through 294

0.3584 - 0.9336i 0.3746 - 0.9272i 0.3907 - 0.9205i

Columns 295 through 297

0.4067 - 0.9135i 0.4226 - 0.9063i 0.4384 - 0.8988i

Columns 298 through 300

0.4540 - 0.8910i 0.4695 - 0.8829i 0.4848 - 0.8746i

Columns 301 through 303

0.5000 - 0.8660i 0.5150 - 0.8572i 0.5299 - 0.8480i

Columns 304 through 306

0.5446 - 0.8387i 0.5592 - 0.8290i 0.5736 - 0.8192i

Columns 307 through 309

0.5878 - 0.8090i 0.6018 - 0.7986i 0.6157 - 0.7880i

Columns 310 through 312

0.6293 - 0.7771i 0.6428 - 0.7660i 0.6561 - 0.7547i

Columns 313 through 315

0.6691 - 0.7431i 0.6820 - 0.7314i 0.6947 - 0.7193i

Columns 316 through 318

0.7071 - 0.7071i 0.7193 - 0.6947i 0.7314 - 0.6820i

Columns 319 through 321

0.7431 - 0.6691i 0.7547 - 0.6561i 0.7660 - 0.6428i

Columns 322 through 324

0.7771 - 0.6293i 0.7880 - 0.6157i 0.7986 - 0.6018i

Columns 325 through 327

0.8090 - 0.5878i 0.8192 - 0.5736i 0.8290 - 0.5592i

Columns 328 through 330

0.8387 - 0.5446i 0.8480 - 0.5299i 0.8572 - 0.5150i

Columns 331 through 333

0.8660 - 0.5000i 0.8746 - 0.4848i 0.8829 - 0.4695i

Columns 334 through 336

0.8910 - 0.4540i 0.8988 - 0.4384i 0.9063 - 0.4226i

Columns 337 through 339

0.9135 - 0.4067i 0.9205 - 0.3907i 0.9272 - 0.3746i

Columns 340 through 342

0.9336 - 0.3584i 0.9397 - 0.3420i 0.9455 - 0.3256i

Columns 343 through 345

0.9511 - 0.3090i 0.9563 - 0.2924i 0.9613 - 0.2756i

Columns 346 through 348

0.9659 - 0.2588i 0.9703 - 0.2419i 0.9744 - 0.2250i

Columns 349 through 351

0.9781 - 0.2079i 0.9816 - 0.1908i 0.9848 - 0.1736i

Columns 352 through 354

0.9877 - 0.1564i 0.9903 - 0.1392i 0.9925 - 0.1219i

Columns 355 through 357

0.9945 - 0.1045i 0.9962 - 0.0872i 0.9976 - 0.0698i

Columns 358 through 360

0.9986 - 0.0523i 0.9994 - 0.0349i 0.9998 - 0.0175i

Column 361

1.0000 - 0.0000i

執行流程二

>> eix=exp(i*theta)

eix =

Columns 1 through 3

1.0000 0.9998 + 0.0175i 0.9994 + 0.0349i

Columns 4 through 6

0.9986 + 0.0523i 0.9976 + 0.0698i 0.9962 + 0.0872i

Columns 7 through 9

0.9945 + 0.1045i 0.9925 + 0.1219i 0.9903 + 0.1392i

Columns 10 through 12

0.9877 + 0.1564i 0.9848 + 0.1736i 0.9816 + 0.1908i

Columns 13 through 15

0.9781 + 0.2079i 0.9744 + 0.2250i 0.9703 + 0.2419i

Columns 16 through 18

0.9659 + 0.2588i 0.9613 + 0.2756i 0.9563 + 0.2924i

Columns 19 through 21

0.9511 + 0.3090i 0.9455 + 0.3256i 0.9397 + 0.3420i

Columns 22 through 24

0.9336 + 0.3584i 0.9272 + 0.3746i 0.9205 + 0.3907i

Columns 25 through 27

0.9135 + 0.4067i 0.9063 + 0.4226i 0.8988 + 0.4384i

Columns 28 through 30

0.8910 + 0.4540i 0.8829 + 0.4695i 0.8746 + 0.4848i

Columns 31 through 33

0.8660 + 0.5000i 0.8572 + 0.5150i 0.8480 + 0.5299i

Columns 34 through 36

0.8387 + 0.5446i 0.8290 + 0.5592i 0.8192 + 0.5736i

Columns 37 through 39

0.8090 + 0.5878i 0.7986 + 0.6018i 0.7880 + 0.6157i

Columns 40 through 42

0.7771 + 0.6293i 0.7660 + 0.6428i 0.7547 + 0.6561i

Columns 43 through 45

0.7431 + 0.6691i 0.7314 + 0.6820i 0.7193 + 0.6947i

Columns 46 through 48

0.7071 + 0.7071i 0.6947 + 0.7193i 0.6820 + 0.7314i

Columns 49 through 51

0.6691 + 0.7431i 0.6561 + 0.7547i 0.6428 + 0.7660i

Columns 52 through 54

0.6293 + 0.7771i 0.6157 + 0.7880i 0.6018 + 0.7986i

Columns 55 through 57

0.5878 + 0.8090i 0.5736 + 0.8192i 0.5592 + 0.8290i

Columns 58 through 60

0.5446 + 0.8387i 0.5299 + 0.8480i 0.5150 + 0.8572i

Columns 61 through 63

0.5000 + 0.8660i 0.4848 + 0.8746i 0.4695 + 0.8829i

Columns 64 through 66

0.4540 + 0.8910i 0.4384 + 0.8988i 0.4226 + 0.9063i

Columns 67 through 69

0.4067 + 0.9135i 0.3907 + 0.9205i 0.3746 + 0.9272i

Columns 70 through 72

0.3584 + 0.9336i 0.3420 + 0.9397i 0.3256 + 0.9455i

Columns 73 through 75

0.3090 + 0.9511i 0.2924 + 0.9563i 0.2756 + 0.9613i

Columns 76 through 78

0.2588 + 0.9659i 0.2419 + 0.9703i 0.2250 + 0.9744i

Columns 79 through 81

0.2079 + 0.9781i 0.1908 + 0.9816i 0.1736 + 0.9848i

Columns 82 through 84

0.1564 + 0.9877i 0.1392 + 0.9903i 0.1219 + 0.9925i

Columns 85 through 87

0.1045 + 0.9945i 0.0872 + 0.9962i 0.0698 + 0.9976i

Columns 88 through 90

0.0523 + 0.9986i 0.0349 + 0.9994i 0.0175 + 0.9998i

Columns 91 through 93

0.0000 + 1.0000i -0.0175 + 0.9998i -0.0349 + 0.9994i

Columns 94 through 96

-0.0523 + 0.9986i -0.0698 + 0.9976i -0.0872 + 0.9962i

Columns 97 through 99

-0.1045 + 0.9945i -0.1219 + 0.9925i -0.1392 + 0.9903i

Columns 100 through 102

-0.1564 + 0.9877i -0.1736 + 0.9848i -0.1908 + 0.9816i

Columns 103 through 105

-0.2079 + 0.9781i -0.2250 + 0.9744i -0.2419 + 0.9703i

Columns 106 through 108

-0.2588 + 0.9659i -0.2756 + 0.9613i -0.2924 + 0.9563i

Columns 109 through 111

-0.3090 + 0.9511i -0.3256 + 0.9455i -0.3420 + 0.9397i

Columns 112 through 114

-0.3584 + 0.9336i -0.3746 + 0.9272i -0.3907 + 0.9205i

Columns 115 through 117

-0.4067 + 0.9135i -0.4226 + 0.9063i -0.4384 + 0.8988i

Columns 118 through 120

-0.4540 + 0.8910i -0.4695 + 0.8829i -0.4848 + 0.8746i

Columns 121 through 123

-0.5000 + 0.8660i -0.5150 + 0.8572i -0.5299 + 0.8480i

Columns 124 through 126

-0.5446 + 0.8387i -0.5592 + 0.8290i -0.5736 + 0.8192i

Columns 127 through 129

-0.5878 + 0.8090i -0.6018 + 0.7986i -0.6157 + 0.7880i

Columns 130 through 132

-0.6293 + 0.7771i -0.6428 + 0.7660i -0.6561 + 0.7547i

Columns 133 through 135

-0.6691 + 0.7431i -0.6820 + 0.7314i -0.6947 + 0.7193i

Columns 136 through 138

-0.7071 + 0.7071i -0.7193 + 0.6947i -0.7314 + 0.6820i

Columns 139 through 141

-0.7431 + 0.6691i -0.7547 + 0.6561i -0.7660 + 0.6428i

Columns 142 through 144

-0.7771 + 0.6293i -0.7880 + 0.6157i -0.7986 + 0.6018i

Columns 145 through 147

-0.8090 + 0.5878i -0.8192 + 0.5736i -0.8290 + 0.5592i

Columns 148 through 150

-0.8387 + 0.5446i -0.8480 + 0.5299i -0.8572 + 0.5150i

Columns 151 through 153

-0.8660 + 0.5000i -0.8746 + 0.4848i -0.8829 + 0.4695i

Columns 154 through 156

-0.8910 + 0.4540i -0.8988 + 0.4384i -0.9063 + 0.4226i

Columns 157 through 159

-0.9135 + 0.4067i -0.9205 + 0.3907i -0.9272 + 0.3746i

Columns 160 through 162

-0.9336 + 0.3584i -0.9397 + 0.3420i -0.9455 + 0.3256i

Columns 163 through 165

-0.9511 + 0.3090i -0.9563 + 0.2924i -0.9613 + 0.2756i

Columns 166 through 168

-0.9659 + 0.2588i -0.9703 + 0.2419i -0.9744 + 0.2250i

Columns 169 through 171

-0.9781 + 0.2079i -0.9816 + 0.1908i -0.9848 + 0.1736i

Columns 172 through 174

-0.9877 + 0.1564i -0.9903 + 0.1392i -0.9925 + 0.1219i

Columns 175 through 177

-0.9945 + 0.1045i -0.9962 + 0.0872i -0.9976 + 0.0698i

Columns 178 through 180

-0.9986 + 0.0523i -0.9994 + 0.0349i -0.9998 + 0.0175i

Columns 181 through 183

-1.0000 + 0.0000i -0.9998 - 0.0175i -0.9994 - 0.0349i

Columns 184 through 186

-0.9986 - 0.0523i -0.9976 - 0.0698i -0.9962 - 0.0872i

Columns 187 through 189

-0.9945 - 0.1045i -0.9925 - 0.1219i -0.9903 - 0.1392i

Columns 190 through 192

-0.9877 - 0.1564i -0.9848 - 0.1736i -0.9816 - 0.1908i

Columns 193 through 195

-0.9781 - 0.2079i -0.9744 - 0.2250i -0.9703 - 0.2419i

Columns 196 through 198

-0.9659 - 0.2588i -0.9613 - 0.2756i -0.9563 - 0.2924i

Columns 199 through 201

-0.9511 - 0.3090i -0.9455 - 0.3256i -0.9397 - 0.3420i

Columns 202 through 204

-0.9336 - 0.3584i -0.9272 - 0.3746i -0.9205 - 0.3907i

Columns 205 through 207

-0.9135 - 0.4067i -0.9063 - 0.4226i -0.8988 - 0.4384i

Columns 208 through 210

-0.8910 - 0.4540i -0.8829 - 0.4695i -0.8746 - 0.4848i

Columns 211 through 213

-0.8660 - 0.5000i -0.8572 - 0.5150i -0.8480 - 0.5299i

Columns 214 through 216

-0.8387 - 0.5446i -0.8290 - 0.5592i -0.8192 - 0.5736i

Columns 217 through 219

-0.8090 - 0.5878i -0.7986 - 0.6018i -0.7880 - 0.6157i

Columns 220 through 222

-0.7771 - 0.6293i -0.7660 - 0.6428i -0.7547 - 0.6561i

Columns 223 through 225

-0.7431 - 0.6691i -0.7314 - 0.6820i -0.7193 - 0.6947i

Columns 226 through 228

-0.7071 - 0.7071i -0.6947 - 0.7193i -0.6820 - 0.7314i

Columns 229 through 231

-0.6691 - 0.7431i -0.6561 - 0.7547i -0.6428 - 0.7660i

Columns 232 through 234

-0.6293 - 0.7771i -0.6157 - 0.7880i -0.6018 - 0.7986i

Columns 235 through 237

-0.5878 - 0.8090i -0.5736 - 0.8192i -0.5592 - 0.8290i

Columns 238 through 240

-0.5446 - 0.8387i -0.5299 - 0.8480i -0.5150 - 0.8572i

Columns 241 through 243

-0.5000 - 0.8660i -0.4848 - 0.8746i -0.4695 - 0.8829i

Columns 244 through 246

-0.4540 - 0.8910i -0.4384 - 0.8988i -0.4226 - 0.9063i

Columns 247 through 249

-0.4067 - 0.9135i -0.3907 - 0.9205i -0.3746 - 0.9272i

Columns 250 through 252

-0.3584 - 0.9336i -0.3420 - 0.9397i -0.3256 - 0.9455i

Columns 253 through 255

-0.3090 - 0.9511i -0.2924 - 0.9563i -0.2756 - 0.9613i

Columns 256 through 258

-0.2588 - 0.9659i -0.2419 - 0.9703i -0.2250 - 0.9744i

Columns 259 through 261

-0.2079 - 0.9781i -0.1908 - 0.9816i -0.1736 - 0.9848i

Columns 262 through 264

-0.1564 - 0.9877i -0.1392 - 0.9903i -0.1219 - 0.9925i

Columns 265 through 267

-0.1045 - 0.9945i -0.0872 - 0.9962i -0.0698 - 0.9976i

Columns 268 through 270

-0.0523 - 0.9986i -0.0349 - 0.9994i -0.0175 - 0.9998i

Columns 271 through 273

-0.0000 - 1.0000i 0.0175 - 0.9998i 0.0349 - 0.9994i

Columns 274 through 276

0.0523 - 0.9986i 0.0698 - 0.9976i 0.0872 - 0.9962i

Columns 277 through 279

0.1045 - 0.9945i 0.1219 - 0.9925i 0.1392 - 0.9903i

Columns 280 through 282

0.1564 - 0.9877i 0.1736 - 0.9848i 0.1908 - 0.9816i

Columns 283 through 285

0.2079 - 0.9781i 0.2250 - 0.9744i 0.2419 - 0.9703i

Columns 286 through 288

0.2588 - 0.9659i 0.2756 - 0.9613i 0.2924 - 0.9563i

Columns 289 through 291

0.3090 - 0.9511i 0.3256 - 0.9455i 0.3420 - 0.9397i

Columns 292 through 294

0.3584 - 0.9336i 0.3746 - 0.9272i 0.3907 - 0.9205i

Columns 295 through 297

0.4067 - 0.9135i 0.4226 - 0.9063i 0.4384 - 0.8988i

Columns 298 through 300

0.4540 - 0.8910i 0.4695 - 0.8829i 0.4848 - 0.8746i

Columns 301 through 303

0.5000 - 0.8660i 0.5150 - 0.8572i 0.5299 - 0.8480i

Columns 304 through 306

0.5446 - 0.8387i 0.5592 - 0.8290i 0.5736 - 0.8192i

Columns 307 through 309

0.5878 - 0.8090i 0.6018 - 0.7986i 0.6157 - 0.7880i

Columns 310 through 312

0.6293 - 0.7771i 0.6428 - 0.7660i 0.6561 - 0.7547i

Columns 313 through 315

0.6691 - 0.7431i 0.6820 - 0.7314i 0.6947 - 0.7193i

Columns 316 through 318

0.7071 - 0.7071i 0.7193 - 0.6947i 0.7314 - 0.6820i

Columns 319 through 321

0.7431 - 0.6691i 0.7547 - 0.6561i 0.7660 - 0.6428i

Columns 322 through 324

0.7771 - 0.6293i 0.7880 - 0.6157i 0.7986 - 0.6018i

Columns 325 through 327

0.8090 - 0.5878i 0.8192 - 0.5736i 0.8290 - 0.5592i

Columns 328 through 330

0.8387 - 0.5446i 0.8480 - 0.5299i 0.8572 - 0.5150i

Columns 331 through 333

0.8660 - 0.5000i 0.8746 - 0.4848i 0.8829 - 0.4695i

Columns 334 through 336

0.8910 - 0.4540i 0.8988 - 0.4384i 0.9063 - 0.4226i

Columns 337 through 339

0.9135 - 0.4067i 0.9205 - 0.3907i 0.9272 - 0.3746i

Columns 340 through 342

0.9336 - 0.3584i 0.9397 - 0.3420i 0.9455 - 0.3256i

Columns 343 through 345

0.9511 - 0.3090i 0.9563 - 0.2924i 0.9613 - 0.2756i

Columns 346 through 348

0.9659 - 0.2588i 0.9703 - 0.2419i 0.9744 - 0.2250i

Columns 349 through 351

0.9781 - 0.2079i 0.9816 - 0.1908i 0.9848 - 0.1736i

Columns 352 through 354

0.9877 - 0.1564i 0.9903 - 0.1392i 0.9925 - 0.1219i

Columns 355 through 357

0.9945 - 0.1045i 0.9962 - 0.0872i 0.9976 - 0.0698i

Columns 358 through 360

0.9986 - 0.0523i 0.9994 - 0.0349i 0.9998 - 0.0175i

Column 361

1.0000 - 0.0000i

執行流程一

>> theta=[0:360]/180*pi

theta =

Columns 1 through 6

0 0.0175 0.0349 0.0524 0.0698 0.0873

Columns 7 through 12

0.1047 0.1222 0.1396 0.1571 0.1745 0.1920

Columns 13 through 18

0.2094 0.2269 0.2443 0.2618 0.2793 0.2967

Columns 19 through 24

0.3142 0.3316 0.3491 0.3665 0.3840 0.4014

Columns 25 through 30

0.4189 0.4363 0.4538 0.4712 0.4887 0.5061

Columns 31 through 36

0.5236 0.5411 0.5585 0.5760 0.5934 0.6109

Columns 37 through 42

0.6283 0.6458 0.6632 0.6807 0.6981 0.7156

Columns 43 through 48

0.7330 0.7505 0.7679 0.7854 0.8029 0.8203

Columns 49 through 54

0.8378 0.8552 0.8727 0.8901 0.9076 0.9250

Columns 55 through 60

0.9425 0.9599 0.9774 0.9948 1.0123 1.0297

Columns 61 through 66

1.0472 1.0647 1.0821 1.0996 1.1170 1.1345

Columns 67 through 72

1.1519 1.1694 1.1868 1.2043 1.2217 1.2392

Columns 73 through 78

1.2566 1.2741 1.2915 1.3090 1.3265 1.3439

Columns 79 through 84

1.3614 1.3788 1.3963 1.4137 1.4312 1.4486

Columns 85 through 90

1.4661 1.4835 1.5010 1.5184 1.5359 1.5533

Columns 91 through 96

1.5708 1.5882 1.6057 1.6232 1.6406 1.6581

Columns 97 through 102

1.6755 1.6930 1.7104 1.7279 1.7453 1.7628

Columns 103 through 108

1.7802 1.7977 1.8151 1.8326 1.8500 1.8675

Columns 109 through 114

1.8850 1.9024 1.9199 1.9373 1.9548 1.9722

Columns 115 through 120

1.9897 2.0071 2.0246 2.0420 2.0595 2.0769

Columns 121 through 126

2.0944 2.1118 2.1293 2.1468 2.1642 2.1817

Columns 127 through 132

2.1991 2.2166 2.2340 2.2515 2.2689 2.2864

Columns 133 through 138

2.3038 2.3213 2.3387 2.3562 2.3736 2.3911

Columns 139 through 144

2.4086 2.4260 2.4435 2.4609 2.4784 2.4958

Columns 145 through 150

2.5133 2.5307 2.5482 2.5656 2.5831 2.6005

Columns 151 through 156

2.6180 2.6354 2.6529 2.6704 2.6878 2.7053

Columns 157 through 162

2.7227 2.7402 2.7576 2.7751 2.7925 2.8100

Columns 163 through 168

2.8274 2.8449 2.8623 2.8798 2.8972 2.9147

Columns 169 through 174

2.9322 2.9496 2.9671 2.9845 3.0020 3.0194

Columns 175 through 180

3.0369 3.0543 3.0718 3.0892 3.1067 3.1241

Columns 181 through 186

3.1416 3.1590 3.1765 3.1940 3.2114 3.2289

Columns 187 through 192

3.2463 3.2638 3.2812 3.2987 3.3161 3.3336

Columns 193 through 198

3.3510 3.3685 3.3859 3.4034 3.4208 3.4383

Columns 199 through 204

3.4558 3.4732 3.4907 3.5081 3.5256 3.5430

Columns 205 through 210

3.5605 3.5779 3.5954 3.6128 3.6303 3.6477

Columns 211 through 216

3.6652 3.6826 3.7001 3.7176 3.7350 3.7525

Columns 217 through 222

3.7699 3.7874 3.8048 3.8223 3.8397 3.8572

Columns 223 through 228

3.8746 3.8921 3.9095 3.9270 3.9444 3.9619

Columns 229 through 234

3.9794 3.9968 4.0143 4.0317 4.0492 4.0666

Columns 235 through 240

4.0841 4.1015 4.1190 4.1364 4.1539 4.1713

Columns 241 through 246

4.1888 4.2062 4.2237 4.2412 4.2586 4.2761

Columns 247 through 252

4.2935 4.3110 4.3284 4.3459 4.3633 4.3808

Columns 253 through 258

4.3982 4.4157 4.4331 4.4506 4.4680 4.4855

Columns 259 through 264

4.5029 4.5204 4.5379 4.5553 4.5728 4.5902

Columns 265 through 270

4.6077 4.6251 4.6426 4.6600 4.6775 4.6949

Columns 271 through 276

4.7124 4.7298 4.7473 4.7647 4.7822 4.7997

Columns 277 through 282

4.8171 4.8346 4.8520 4.8695 4.8869 4.9044

Columns 283 through 288

4.9218 4.9393 4.9567 4.9742 4.9916 5.0091

Columns 289 through 294

5.0265 5.0440 5.0615 5.0789 5.0964 5.1138

Columns 295 through 300

5.1313 5.1487 5.1662 5.1836 5.2011 5.2185

Columns 301 through 306

5.2360 5.2534 5.2709 5.2883 5.3058 5.3233

Columns 307 through 312

5.3407 5.3582 5.3756 5.3931 5.4105 5.4280

Columns 313 through 318

5.4454 5.4629 5.4803 5.4978 5.5152 5.5327

Columns 319 through 324

5.5501 5.5676 5.5851 5.6025 5.6200 5.6374

Columns 325 through 330

5.6549 5.6723 5.6898 5.7072 5.7247 5.7421

Columns 331 through 336

5.7596 5.7770 5.7945 5.8119 5.8294 5.8469

Columns 337 through 342

5.8643 5.8818 5.8992 5.9167 5.9341 5.9516

Columns 343 through 348

5.9690 5.9865 6.0039 6.0214 6.0388 6.0563

Columns 349 through 354

6.0737 6.0912 6.1087 6.1261 6.1436 6.1610

Columns 355 through 360

6.1785 6.1959 6.2134 6.2308 6.2483 6.2657

Column 361

6.2832

Friday, October 13, 2006

第一po

好好加油