How to draw an polar image under polar coordinate

23 vues (au cours des 30 derniers jours)
yangyichun yang
yangyichun yang le 17 Jan 2016
Commenté : Walter Roberson le 18 Avr 2023
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.
  1 commentaire
Stuart Anderson
Stuart Anderson le 17 Avr 2023
Exactly what I needed. Thanks a lot.

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 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 commentaires
Walter Roberson
Walter Roberson le 18 Avr 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Polar Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by