您当前的位置: 首页 >  matlab

MATLAB 三维曲线

发布时间:2022-01-12 19:58:36 ,浏览量:5

MATLAB 三维曲线

plot3函数 plot3(x,y,z)

eg:绘制一条空间折线

x=[0.2,1.8,2.5]; y=[1.3,2.8,1.1]; z=[0.4,1.2,1.6]; plot3(x,y,z) grid on
axis([0,3,1,3,0,2]); 

在这里插入图片描述

eg:

在这里插入图片描述

t=linspace(0,10*pi,200); x=sin(t)+t.*cos(t); y=cos(t)-t.*sin(t); z=t; subplot(1,2,1) plot3(x,y,z) grid on
subplot(1,2,2) plot3(x(1:4:200),y(1:4:200),z(1:4:200)) grid on

在这里插入图片描述

eg:在空间不同位置绘制5条正弦曲线。

%方法一:
t=0:0.01:2*pi; t=t';%转置
x=[t,t,t,t,t]; y=[sin(t),sin(t)+1,sin(t)+2,sin(t)+3,sin(t)+4]; z=[t,t,t,t,t]; plot3(x,y,z) 
%方法二:
t=0:0.01:2*pi; x=t; y=[sin(t),sin(t)+1,sin(t)+2,sin(t)+3,sin(t)+4]; z=t; plot3(x,y,z) 

在这里插入图片描述

eg:绘制出三条不同长度的正弦曲线。

t1=0:0.01:1.5*pi; t2=0:0.01:2*pi; t3=0:0.01:3*pi; plot3(t1,sin(t1),t1,t2,sin(t2)+1,t2,t3,sin(t3)+2,t3) 

在这里插入图片描述

eg:

在这里插入图片描述

t=0:pi/50:6*pi; x=cos(t); y=sin(t); z=2*t; plot3(x,y,z,'p') xlabel('X'),ylabel('Y'),zlabel('Z'); grid on

在这里插入图片描述

eg:

在这里插入图片描述

xt=@(t)exp(-t/10).*sin(5*t); yt=@(t)exp(-t/10).*cos(5*t); zt=@(t)t; fplot3(xt,yt,zt,[-12,12],'r-') 

在这里插入图片描述

关注
打赏
1688896170
查看更多评论

暂无认证

  • 5浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0879s