Effacer les filtres
Effacer les filtres

Mark Multiple minimum and maximum value in polarplot

3 vues (au cours des 30 derniers jours)
Arief Yoga Randytama
Arief Yoga Randytama le 16 Juil 2021
Hi, I have created the code to plot a data in polar coordinates as such:
theta=deg2rad(0:30:330);
r=[2.14 2.29 2.14 2.00 2.14 2.29 2.14 2.00 2.00 2.57 2.14 2.00];
polarplot(theta([1:end 1]),r([1:end 1]))
ax=gca
ax.ThetaZeroLocation='right'
ax.ThetaDir='counterclockwise'
title('RSR Value of Maximum Water Depth')
Now i want to mark all 3 minimum value of r (2.00) with a red circle, and also the maximum value with a green star. How can i do it? Thanks

Réponse acceptée

KSSV
KSSV le 16 Juil 2021
theta=deg2rad(0:30:330);
r=[2.14 2.29 2.14 2.00 2.14 2.29 2.14 2.00 2.00 2.57 2.14 2.00];
polarplot(theta([1:end 1]),r([1:end 1])) ;
[val0,idx0] = min(r) ;
[val1,idx1] = max(r) ;
hold on
polarplot(theta(idx0),val0,'*r') ;
polarplot(theta(idx1),val1,'*k') ;
ax=gca ;
ax.ThetaZeroLocation='right' ;
ax.ThetaDir='counterclockwise' ;
title('RSR Value of Maximum Water Depth')
  1 commentaire
Arief Yoga Randytama
Arief Yoga Randytama le 16 Juil 2021
Thanks! this works just fine, but i noticed that val0 and idx0 only reads one minimum value of r. Meanwhile, what i intended is mark all the minimum r value, which belongs to 90, 210, and 240 degree. Can it be done? Thanks again.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by