How does "polarplot" handle points with radius less than the the lower radial limit set using the "rlim" function in MATLAB?

11 ビュー (過去 30 日間)
I am using MATLAB R2023b to plot rings on a polar plot by using the "polarplot" function. 
I have used the "rlim" function to set the lower radial limit to 10, and the upper radial limit to 40:
>> rlim([10,40])
However, when I plot rings with radius less than 10, they seem to be plotted in random positions on my plot. For example, a ring with radius 0 is plotted at radius 20. Please see the screenshot below: 
Is this intended behaviour?

採用された回答

MathWorks Support Team
MathWorks Support Team 2025 年 3 月 7 日
編集済み: MathWorks Support Team 2025 年 3 月 7 日
This is the expected behaviour of the "polarplot" function. This behaviour is due to the mathematical principles underlying polar plots, which differ from those of Cartesian plots.
As outlined in the MathWorks documentation for the "polarplot" function, "polarplot" will, by default, reflect negative values through the origin. When you enter the following command:
>> rlim([10,40])
the origin of the polar plot is set to a radius of 10. Consequently, all radius values less than 10 are treated similarly to how negative values would be treated if the origin still had a radius of 0. In this case, values less than 10 are reflected through the new origin of 10 and will appear on the plot.
For example, points with a radius of 0 will be reflected through the new origin of 10 to a radius of 20. Similarly, points with a radius of 5 will be reflected through the origin of 10 to a radius of 15. This behaviour aligns with the mathematical principles of polar plots and is an intended feature specific to polar plots.
To work around this behaviour, it is recommended to filter your data points before plotting, so that all points with a radius less than 10 are removed.
  1 件のコメント
Adam Danz
Adam Danz 2025 年 1 月 14 日
Here's a demonstration of this oddity. Note that the radial axis limit RLim is [0,1] but the data point at 90 degrees has an RData value of -0.5.
theta = [0 30 60 90 120 150 180];
radius = [1 1 1 -.5 1 1 1];
polarplot(theta*pi/180, radius,'-o','LineWidth',2)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by