I have a plot of 3 traveling waves at time 200(I use the drawnow function) that looks like below.
In fact, this is a cross-section of radial symmetric traveling waves in 3 dimension(just like a circle that is expanding).
So the 3-D plot is just this 2-D plot rotating 360 degrees around the y-axis.
I want to draw this 3-D plot of the traveling waves.
How can I do this in matlab?
I tried to use the polarplot function in matlab. But it does not support 3-D plot.
Since you didn't provide us with demo data I had to create my own. Let's consider the following
y1andy2curves:This will give something looking like some of your curves:
The important part for the next step is that you have a
yvector defined for each of the curve you want to rotate around theYaxis.The idea is to copy this
ycurve into everythetasteps of a cylindrical coordinate referential grid. Then convert back everything to cartesian for use withsurf().This gives you the curve
y1rotated around theOyaxis. Note how the output ofpol2cartare ordered in order to respect the rotation aroundOy:Now to repeat this on any other curve is trivially the same method:
Which yields: