简体   繁体   English

我想在Matlab中的3D中绘制函数

[英]I want to plot a function in 3d in matlab

I have a function, X . 我有一个函数X。 It has inputs t and d . 它具有输入td

X generates a 3x1 array, effectively an X,Y,Z tuple representing a point in 3-dimensional space. X生成一个3x1数组,实际上是一个X,Y,Z元组,表示3维空间中的一个点。

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.) 考虑到0 < t <360和0 < d <5,我想为td的所有值生成一个图。(它们不是向量。)

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. plot3(X(1),X(2),X(3),'。')只是绘制由t和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. 您可能想为所需的所有t和d值生成一个3xN矩阵,也许使用linspace函数生成要绘制的所有t和d值。

Another option would be to use the ezsurf function as follows: 另一种选择是使用ezsurf函数,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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