Main Content

创建三维绘图

此示例说明如何在 MATLAB 中使用 plot3 函数创建三维线图。

创建一个从 0 到 10*pi 的固定间隔向量 t,使用 pi/50 作为元素之间的增量。

t = 0:pi/50:10*pi;

计算 t 中每个值的正弦值。

st = sin(t);

计算 t 中每个值的余弦值。

ct = cos(t);

使用 'plot3' 函数显示一组数据点的三维绘图。

figure;
plot3(st, ct, t)
xlabel('sin(t)')
ylabel('cos(t)')