How to plot 3D? Surf or Plot3?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Steven
el 3 de Mayo de 2015
Comentada: Steven
el 6 de Mayo de 2015
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
0 comentarios
Respuesta aceptada
Walter Roberson
el 4 de Mayo de 2015
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!