How to plot 3D? Surf or Plot3?

27 ビュー (過去 30 日間)
Steven
Steven 2015 年 5 月 3 日
コメント済み: Steven 2015 年 5 月 6 日
Hello,
Imagine I have a function A(x,y,t).
But the dimensions of y and t are different with that of x (and so A). What I mean is that for example there are values of A(x) for 5 different values of y and 8 different values of t.
Of course, I can plot A vs. x in 2D plot for different values of t for example. But what I want is that can I plot them for different values of y at the same plot as well? how?
How can I plot them all in one plot? Should I use plot3 or Surf?
I tried both including meshgrid, but that doesn't work.
Thanks so much in advance.
Steven

採用された回答

Walter Roberson
Walter Roberson 2015 年 5 月 4 日
You have not given enough information about what you want the resulting plot to look like.
Effectively after running the function you have an output array B which is length(x) by length(y) by length(t), and you want to plot that 3D array. Plotting a 3D array requires 4 dimensions of output -- x, y, z, and value. surf() is for 3 dimensions only, x, y, value.
You can code the additional dimension as colour, shape of a marker, size of a marker, or (as a hint rather than directly) as transparency. Or you can slice() the data or you can create isosurfaces. scatter3() can be pretty useful. Transparency can be useful for voxel rendering. Another possibility is to represent the additional dimension through time (an animation.)
I suspect that you were thinking of something similar to a waterfall plot in which an additional dimension of data is represented through a regular displacement in space. Waterfall plots themselves really only have three dimensions though, such as (x, value, time). You can use the spacial displacement technique with surf() plots, making a stack of hills; if you are thinking about that approach keep in mind the difficulty that the user would have in attempting to clearly examine the values in the "lower" stacks.
  1 件のコメント
Steven
Steven 2015 年 5 月 6 日
Thanks Walter!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by