数学实验——函数绘图实验
生活随笔
收集整理的這篇文章主要介紹了
数学实验——函数绘图实验
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
3、程序設計及運行結果
(1)Octave代碼如下:
clc;clear; a=1; b=1; x=[-10:0.1:10]; y=(b^2*(x.^2/a^2-1)).^0.5; plot(x,y,'k'); title('x^2/a^2-y^2/b^2=1,x=-+b/a*x Asymptote') hold on plot(x,-y,'k') plot(-x,y,'k') plot(-x,-y,'k') %漸近線x=-10:0.1:10; plot(x,b/a.*x,'r') plot(x,-b/a.*x,'r') hold off?
(2)Octave代碼如下:
clear ; clc t=0:0.1:pi; r=0:0.1:2*pi; [r,t]=meshgrid(r,t);x1=1*sin(t).*cos(r); y1=1*sin(t).*sin(r); z1=1*cos(t); mesh(x1,y1,z1); hold on xgrid = -1:0.1:1; ygrid = -1:0.1:1; [x,y] = meshgrid(xgrid,ygrid); z_p = sqrt(x.^2+y.^2); z_n = -sqrt(x.^2+y.^2); mesh(x,y,z_p); hold on; mesh(x,y,z_n); axis equal; axis('square') xlabel('X-axis');ylabel('Y-axis');zlabel('Z-axis'); shading flat; title('The surface of intersecting sphere and cone');?
(3)Octave代碼如下:
clc; clear; t=0:0.1:pi; r=0:0.1:2*pi; [r,t]=meshgrid(r,t); ##The rectangular coordinate equation of the ## ball is transformed into polar coordinate equation ##x^2+y^2+z^2=9 x1=3*sin(t).*cos(r); y1=3*sin(t).*sin(r); z1=3*cos(t); ##Polar coordinate equation of cylinder ##x^2+z^2=4 u=0:0.1:2*pi; v=-3:0.1:3; [u,v]=meshgrid(u,v); x2=2*cos(u); y2=v; z2=2*sin(u); mesh(x1,y1,z1) hold on mesh(x2,y2,z2) xlabel('X-axis');ylabel('Y-axis');zlabel('Z-axis'); shading flat; title('The surface of intersecting sphere and cylinder'); hold off?
4、討論與分析
在畫平面圖形的時候,可以把一個變量變成另外一個變量的表達式,然后再用簡單plot就可以畫出圖像。在一些常見的簡單的三維曲面畫圖時,可以運用極坐標來表示直角坐標系的變量,就可以把問題簡單化,運用基本的繪圖工具即可。在畫一些復雜的函數圖形時,可以選擇使用一些畫曲面的函數。
?
?
?
?
?
總結
以上是生活随笔為你收集整理的数学实验——函数绘图实验的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【JM】电脑检测不到U盘
- 下一篇: 把1,2,3,4,5,6,7,8,9九个