How do you create a surf plot in cylindrical coordinates?
Show older comments
In general, the syntax for a surf plot is surf(X,Y,Z). I have u = F(r,z). I'd like to do surface plots of u for multiple cross sections at z = h1, h2, h3, etc. Is there a simple way to create a surf plot in cylindrical coordinates, i.e., something that would be analagous to the syntax: surf(r,phi,u) where u = u(r,h1)?
Accepted Answer
More Answers (2)
Matt J
on 17 Nov 2012
0 votes
Use TriScatteredInterp to interpolate your data onto a cartesian grid. Then plot using SURF as usual.
Teja Muppirala
on 19 Nov 2012
You can use POL2CART to convert the data from r/theta to x/y and then call SURF.
[R,TH] = ndgrid(0:0.1:5,linspace(0,2*pi,41));
F = @(r,th) sin(th).*sinc(1+r);
Z = F(R,TH);
[X,Y] = pol2cart(TH,R);
surf(X,Y,Z);
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!