MATLAB Answers

0

How to change color in a 3d plot depending from the value in each position?

Asked by Dimitrios on 14 Nov 2014
Latest activity Edited by Mike Garrity
on 14 Nov 2014
I am trying to simulate the loads from air in a vertical wind turbine.I would like to visualize these results.I upload these two picture to be more clear:
This is a simple plot3 i made to visualize the turbine.And lets say that this plot is the force versus Height.
How can in the first figure depending on the value of the load to change the color of the specific position in order to visualize the 'strentgh' of the load?Something like mesh function doing.Btw is it possible to use 'facecolor','interp' somehow?(I dont really need to do it.But i just thought of that and wanted to impliment it).Thanks in advance.

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Mike Garrity
on 14 Nov 2014
Edited by Mike Garrity
on 14 Nov 2014

You can't with plot3, but you can if you use patch. It's not obvious, but you can use patch to draw lines with interpolated colors. You just set FaceColor to none.
ang = linspace(0,2*pi,40)
x = repmat(cos(ang)',[1 15]);
y = repmat(sin(ang)',[1 15]);
z = repmat([1:15],[40 1]);
h = patch(x,y,z,z)
h.FaceColor = 'none';
h.EdgeColor = 'interp';
One other trick is that if you don't want patch to close those loops for you, then you need to end each one with a nan.

  0 Comments

Sign in to comment.