Filter löschen
Filter löschen

Mark Multiple minimum and maximum value in polarplot

3 Ansichten (letzte 30 Tage)
Arief Yoga Randytama
Arief Yoga Randytama am 16 Jul. 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

Akzeptierte Antwort

KSSV
KSSV am 16 Jul. 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 Kommentar
Arief Yoga Randytama
Arief Yoga Randytama am 16 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Polar Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by