How to draw an polar image under polar coordinate
107 views (last 30 days)
Show older comments
Hello, I have a problem when drawing a polar image. The problem is like this. I have a matrix A in which a distribution under polar coordinate Z=f(theta,r) is described by its elements Z=f(theta,r)=A(i,j). I want to draw it under polar coordinate like the function image.m for cartesian coordinates.
Answers (1)
Walter Roberson
on 17 Jan 2016
N = 150;
maxr = 20;
theta = linspace(0, 2*pi, N+1);
r = linspace(0, maxr, N+1);
theta = theta(1:end-1); %throw away 2*pi since it duplicates 0
r = r(2:end); %throw away 0 since that's at the center
[THETA, R] = ndgrid(theta, r);
Z = f(THETA,R);
[X, Y] = pol2cart(THETA,R);
surf(X, Y, Z);
anything beyond that is drawing the circles and labeling
4 Comments
Walter Roberson
on 18 Apr 2023
Note: in the days since I posted the above, Mathworks did add polaraxes that is not in cartesian coordinates at any user-visible level, and added polarplot
But there is still no Mathworks-provided polar image function. There are File Exchange contributions for polar images, and there is the surf work-around that I posted above.
See Also
Categories
Find more on Polar 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!