马鞍线matlab,使⽤matlab编程,怎样画出⼼形线和马鞍⾯?
2018-11-21回答
你的问题确实很⿇烦.
%问题1.
clear
ax1=subplot(1,2,1);
t=0:.01*pi:2*pi;
f1=polar(t,1+cos(t));
title('⼼形线');
legend(f1,'r=1+cost')
ax2=subplot(1,2,2);
x1=linspace(-40,20,40);
y1=linspace(-40,20,40);
[xx1,yy1]=meshgrid(x1,y1);
zz1=xx1.*yy1;
f2=surf(xx1,yy1,zz1);
title('马鞍⾯');
legend(f2,'z=x^2-y^2','location','northwest')
xlabel('x轴')
ylabel('y轴')
zlabel('z轴')
axis([-4020-4])
tallowaxesrotate(rotate3d,ax1,fal);
gridon
%问题2(给你四个程序,你⾃⼰挑吧):
%1)
clear
[x,y,z]=sphere(200);
i=find(x.^2+y.^2-x>=0&x.^2+y.^2+z.^2<1);
z(i)=nan;
mesh(x,y,z)
holdon
t=0:pi/20:2*pi;
x=(cos(t)+1)/2;
y=sin(t)/2;
z=linspace(-1.2,1.2,length(t));
x=meshgrid(x);
y=meshgrid(y);
z=[meshgrid(z)]';
surf(x,y,z)
xlabel('x'),ylabel('y'),zlabel('z')
title('球⾯x^2+y^2+z^2=1和圆柱⾯x^2+y^2=x所围成的区域')
rotate3don
%2)
clear
[x,y,z]=sphere(20);
mesh(x,y,z)
hiddenon
holdon
axiqual
t=0:pi/20:2*pi;
x=(cos(t)+1)/2;
y=sin(t)/2;
z=linspace(-1.2,1.2,length(t));
x=meshgrid(x);
y=meshgrid(y);
z=[meshgrid(z)]';
surf(x,y,z)
xlabel('x'),ylabel('y'),zlabel('z')
rotate3don
%3)
[x,y,z]=sphere(200);
i=find(x.^2+y.^2-x<=0&x.^2+y.^2+z.^2>=1);
z(i)=nan;
mesh(x,y,z)
hiddenon
holdon
ezplot('x^2+y^2=x')
title('球⾯x^2+y^2+z^2=1和圆柱⾯x^2+y^2=x所围成的区域')
rotate3don
%4)
[x,y,z]=sphere(200);
i=find(x.^2+y.^2-x>=0);
z(i)=nan;
mesh(x,y,z)
hiddenon
holdon
ezplot('x^2+y^2=x')
title('球⾯x^2+y^2+z^2=1和圆柱⾯x^2+y^2=x所围成的区域')
rotate3don
本文发布于:2022-12-11 19:10:54,感谢您对本站的认可!
本文链接:http://www.wtabcd.cn/fanwen/fan/88/87460.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |