How to create 3D-Plot in MatLab?

前端 未结 1 849
长发绾君心
长发绾君心 2021-01-17 07:13

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

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

thank you!

相关标签:
1条回答
  • 2021-01-17 07:54

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

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

    0 讨论(0)
提交回复
热议问题