Mark Multiple minimum and maximum value in polarplot

3 次查看(过去 30 天)
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

采纳的回答

KSSV
KSSV 2021-7-16
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 个评论
Arief Yoga Randytama
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polar Plots 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by