简体   繁体   中英

I want to plot a function in 3d in matlab

I have a function, X . It has inputs t and d .

X generates a 3x1 array, effectively an X,Y,Z tuple representing a point in 3-dimensional space.

I want to generate a plot for all values of t and d , given that 0 < t < 360 and 0 < d < 5. (They are not vectors.)

Currently I'm doing:

plot3(X(1),X(2),X(3),'.');
grid on

Which gives me just the one point in space. How should I go about doing this?

plot3(X(1),X(2),X(3),'.') is simply plotting the point generated by one pair of values for t and d.

You will want to generate an 3xN matrix for all the values of t and d that you want, perhaps using the linspace function to generate all the values of t and d that you want to plot.

Another option would be to use the ezsurf function as follows:

ezsurf('t+d',[0 360 0 5])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM