06.08.2013 Views

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

else z(i,j)=0.7575*exp(-y(i)^2-6.*x(j)^2);<br />

end<br />

end<br />

end<br />

axis([-a,a,-b,b,min(min(z)),max(max(z))]);<br />

colormap(flipud(winter));surf(x,y,z);<br />

(2)<br />

exm0701_1<br />

图 7.1-2<br />

【例 7.1-2】通过 M 函数文件画出上例分段函数的曲面。<br />

exm0701_2(2,2)<br />

7.2 M 文本编辑器<br />

7.3 MATLAB 控制流<br />

7.3.1 for 循环结构<br />

【例 7.3.1-1】一个简单的 for 循环示例。<br />

for i=1:10;<br />

x(i)=i;<br />

end;<br />

x<br />

x =<br />

1 2 3 4 5 6 7 8 9 10<br />

7.3.2 while 循环结构<br />

【例 7.3.2-1】Fibonacci 数组的元素满足 Fibonacci 规则: a k + 2 = ak<br />

+ ak<br />

+ 1 , ( k = 1,<br />

2,<br />

)<br />

;<br />

且 a 1 = a2<br />

= 1。现要求该数组中第一个大于<br />

10000 的元素。<br />

a(1)=1;a(2)=1;i=2;<br />

while a(i)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!