Clear Filters
Clear Filters

Mark Multiple minimum and maximum value in polarplot

3 views (last 30 days)
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

Accepted Answer

KSSV
KSSV on 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 Comment
Arief Yoga Randytama
Arief Yoga Randytama on 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.

Sign in to comment.

More Answers (0)

Categories

Find more on Polar Plots in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!