如何在 MatLab 中创建 3D 绘图? [英] How to create 3D-Plot in MatLab?

查看:31
本文介绍了如何在 MatLab 中创建 3D 绘图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我使用以下参数在 MatLab 中创建 3D 绘图:

Please help me to create 3D-Plot in MatLab with this parameters:

x=t
y=t
z=2t^2
0<t<1

谢谢!

推荐答案

Matlab 绘制数据,而不是函数.因此,您需要生成代表您的功能的数据.在这里,我生成了一个包含 100 个 t 值的向量,从 0 到 1(如果您愿意,可以为此使用 linspace()),然后使用它生成 x、y 和 z 值:

Matlab plots data, not functions. So, you need to generate data that represents your function. Here I generate a vector containing 100 values of t from 0 to 1 (you could use linspace() for this if you prefer), then use it to generate the x, y, and z values:

t = [0 : 0.01 : 1]';
x = t;
y = t;
z = 2 * t.^2;

plot3(x,y,z, 'r-');

plot3() 调用将绘图生成为连接 x、y、z 数据点的红线.

The plot3() call generates the plot as a red line connecting your x, y, z data points.

这篇关于如何在 MatLab 中创建 3D 绘图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆