>>正掘 t=(0:0.01:2)*pi;
>> x=sin(t);
>> y=cos(t);
>> z=cos(2*t);
>> plot3(x,y,z,'b-',x,y,z,'bd'),view([-80,58]),box on,legend('lian','diamond')
>派洞>举羡核 plot3(x,y,z,'b-',x,y,z,'bd'),box on,legend('lian','diamond')
三维曲线绘图
t=(0:0.02:2)*pi;x=sin(t);y=cos(t);z=cos(2*t);
plot3(x,y,z,'b-',x,y,z,'bd'),view([-82,58]),box on,legend('和袜链','宝石')
t=(0:0.02:2)*pi;x=sin(t);y=cos(t);z=cos(2*t);
plot3(x,y,z,'唤辩激b-',x,y,z,'bd'),view([-82,58]),box on,legend('链','宝石')
用曲面图表现函灶伍数
clf,x=-4:4;y=x;[X,Y]=meshgrid(x,y);
Z=X.^2+Y.^2;
surf(X,Y,Z);hold on,colormap(hot)
stem3(X,Y,Z,'bo')
上面的例子已经明显说明画曲线图用plot3()函数,而画三维曲面图用surf(),而meshgrid只是画出网格线而已!!