Surf plots 2D + color. I want a 3D plot. What is the solution?

18 ビュー (過去 30 日間)
Mike Mierlo van
Mike Mierlo van 2019 年 10 月 1 日
コメント済み: Mike Mierlo van 2019 年 10 月 1 日
I have the following code:
if true
x= 30:0.1:50;
y= [100:0.1:150]';
Z= x.*y;
I want to have a 3D plot, but I get 2D with color. Please help me with this code


John D'Errico
John D'Errico 2019 年 10 月 1 日
編集済み: John D'Errico 2019 年 10 月 1 日
But what you have, that is z(x,y), is a 2-dimensional manifold in R^3, that is, a surface embedded in the 3-dimensional cartesian space. That is what surf gives you, and you do get 3-d plot, of sorts. As long as you recognize that no plot is truly 3-dimensional, because you have only a 2-d monitor. Your eyes see only a 2-d scene anyway, and then your brain has learned from long training to piece together what is happening due to stereo information from your eyes. That is getting far beyond your question though. But you need to explain what it is that you think something truly 3-dimensional should result from surf, which after all, creates a SURFACE.
help surf
surf 3-D colored surface.
surf(X,Y,Z,C) plots the colored parametric surface...
So it would seem that when you used surf, you got exactly that - a surface.
If you somehow need to see a volume, first, buy a 3-dimensional monitor. I recommend the holodeck you might find on a TV show, but Starfleet supply tends to be slow in delivery times. Mine is still on backorder, although forward order seems a better name, since it must come from the future. Better perhaps might be to buy a holographic projector. They are probably expensive. Watch out for the lasers too, as if they zap your vision in one or both eyes, then forget about 3-dimensional viewing at all.
Ok, perhaps what you really want is to see a plot of a 3-dimensional volume. For that, you need to first create a representation of a 3-dimensional object that actually contains volume. But then you can only plot the surface of that volume, because the plot will still be a two dimensional projection anyway. It really does come down to that 2-monitor you have, and your 2-d eyes. There are tools out there that give you two different projections in stereo, that you then need to view by crossing your eyes, but many people find that a difficult thing to do without practice.
I'm not sure this answer has truly been helpful in solving your difficult problem, but, perhaps the solution is to either change your goals, or better define what you want to do? In the end, remember that surf (like any piece of computer software) does what it is designed to do, not what your mind thinks it wants to do. Mind reading software is expensive anyway, and usually requires another slowly fulfilled requisition from Starfleet command.
  4 件のコメント
Mike Mierlo van
Mike Mierlo van 2019 年 10 月 1 日
Yeah. And I am using matlab mobile on an tablet now. Guess not all functions are working well on the mobile version.


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by