MATLAB 三维曲线

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-')

在这里插入图片描述

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jeff one

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值