freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

matlab編程必備手冊-資料下載頁

2025-06-25 07:11本頁面
  

【正文】 的矩陣 mesh(xx, yy, zz)。 % 畫出立體網(wǎng)狀圖 surf和mesh的用法類似: x=linspace(2, 2, 25)。 % 在x軸上取25點 y=linspace(2, 2, 25)。 % 在y軸上取25點 [xx,yy]=meshgrid(x, y)。 % xx和yy都是21x21的矩陣 zz=xx.*exp(xx.^2yy.^2)。 % 計算函數(shù)值,zz也是21x21的矩陣 surf(xx, yy, zz)。 % 畫出立體曲面圖 為了方便測試立體繪圖,MATLAB提供了一個peaks函數(shù),可產(chǎn)生一個凹凸有 致的曲面,包含了三個局部極大點及三個局部極小點,其方程式為: 要畫出此函數(shù)的最快方法即是直接鍵入peaks: peaks z = 3*(1x).^2.*exp((x.^2) (y+1).^2) ... 10*(x/5 x.^3 y.^5).*exp(x.^2y.^2) ... 1/3*exp((x+1).^2 y.^2) 我們亦可對peaks函數(shù)取點,再以各種不同方法進行繪圖。meshz可將曲面 加上圍裙: [x,y,z]=peaks。 meshz(x,y,z)。 axis([inf inf inf inf inf inf])。 waterfall可在x方向或y方向產(chǎn)生水流效果: [x,y,z]=peaks。 waterfall(x,y,z)。 axis([inf inf inf inf inf inf])。 下列命令產(chǎn)生在y方向的水流效果: [x,y,z]=peaks。 waterfall(x39。,y39。,z39。)。 axis([inf inf inf inf inf inf])。 meshc同時畫出網(wǎng)狀圖與等高線: [x,y,z]=peaks。 meshc(x,y,z)。 axis([inf inf inf inf inf inf])。 surfc同時畫出曲面圖與等高線: [x,y,z]=peaks。 surfc(x,y,z)。 axis([inf inf inf inf inf inf])。 contour3畫出曲面在三度空間中的等高線: contour3(peaks, 20)。 axis([inf inf inf inf inf inf])。 contour畫出曲面等高線在XY平面的投影: contour(peaks, 20)。 plot3可畫出三度空間中的曲線: t=linspace(0,20*pi, 501)。 plot3(t.*sin(t), t.*cos(t), t)。 亦可同時畫出兩條三度空間中的曲線: t=linspace(0, 10*pi, 501)。 plot3(t.*sin(t), t.*cos(t), t, t.*sin(t), t.*cos(t), t)。 y(2:4)1 % 取出y的第二至第四個元素來做運算 同樣的方法可用於產(chǎn)生公差為1的等差數(shù)列:x = 7:16 x = 7:3:16 % 公差為3的等差數(shù)列 x = linspace(4, 10, 6) % 等差數(shù)列:首項為4,末項為10,項數(shù)為6 若要重新安排矩陣的形狀,可用reshape命令:B = reshape(A, 4, 2) % 4是新矩陣的列數(shù),2是新矩陣的行數(shù) 舉例來說,下列命令會產(chǎn)生一個長度為6的調(diào)和數(shù)列(Harmonic sequence): x = zeros(1,6)。 % x是一個16的零矩陣 for i = 1:6, x(i) = 1/i。 end for圈可以是多層的,下例產(chǎn)生一個16的Hilbert矩陣h,其中為於第i 列、第j行的元素為: h = zeros(6)。 for i = 1:6, for j = 1:6, h(i,j) = 1/(i+j1)。 end end format rat % 使用分?jǐn)?shù)來表示數(shù)值 disp(x) 1 1/2 1/3 1/4 1/5 1/6 function output = fact(n) % FACT Calculate factorial of a given positive integer. output = 1。 for i = 1:n, output = output*i。 end 其中fact是函數(shù)名,n是輸入引數(shù),output是輸出引數(shù),而i則是此函數(shù)用 到的暫時變數(shù)。要使用此函數(shù),直接鍵入函數(shù)名及適當(dāng)輸入引數(shù)值即可: MATLAB的函數(shù)也可以是遞式的(Recursive),也就是說,一個函數(shù)可以 呼叫它本身。舉例來說,n! =n*(n1)!,因此前面的階乘函數(shù)可以改成遞式的寫法: function output = fact(n)% FACT Calculate factorial of a given positive integer recursively. if n == 1, % Terminating condition output = 1。 return。 end output = n*fact(n1)。 在寫一個遞函數(shù)時,一定要包含結(jié)束條件(Terminating condition),否則此函數(shù)將會一再呼叫自己,永遠不會停止,直到電腦的 記憶體被耗盡為止。以上例而言,n==1即滿足結(jié)束條件,此時我們直接將 output設(shè)為1,而不再呼叫此函數(shù)本身。
點擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1