Matlab三位曲线之plot3函数

plot3函数与plot函数的使用方式相近。plot函数具体可参见:https://blog.csdn.net/Mrweng1996/article/details/104338453

1、plot3函数的基本用法:

plot3(x, y, z):其中,x、y、z组成一组曲线的坐标。

代码示例:

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

运行结果:

2、 plot3函数参数的变化形式

plot3(x, y, z)

参数x,y,z为同型矩阵。

参数x,y,z中有向量,有矩阵。

代码示例:

clc;
clear all;

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

运行结果:

3、含有多组输入参数的plot3函数

plot3(x1, y1, z1, x2, y2, z2 ..., xn, yn, zn) :每一组x、y、z组成一组数据点的坐标,绘制一条曲线。

clc;
clear all;

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)
grid on

运行结果:

4、含有选项的plot3函数

plot(x, y, z, 选项):选项适用于指定曲线的线型、颜色和数据点标记。

代码示例:

clc;
clear all;

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

 运行结果:

  • 14
    点赞
  • 66
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值