How can I plot a horizontal line for a polar plot?

I have a polar plot of two lines with an equation to get the percent error between them. How do I plot a horzontal line where the percent error is at 5%?
Code is below.
Thanks in advance.
alpha = 0:0.01:(1/2) * pi;
y = sin(alpha);
polarplot(alpha,y) %first plot
pause(1)
hold on
polarplot(y.*(alpha)==alpha) %second plot
pError = 100*(alpha-sin(alpha))./sin(alpha); %percent difference
disp(pError);
pause(1)
polarplot(pError .* .05) %horizontal line at 5% error
hold off

2 件のコメント

Star Strider
Star Strider 2020 年 4 月 29 日
It looks as though you already did that:
polarplot(pError .* .05) %horizontal line at 5% error
What do you want it to be?
Christian Bellew
Christian Bellew 2020 年 4 月 29 日
Yes, but it plots a curved line instead of a horizontal one. I would like the horizontal line to be where the error reaches 5%.

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

 採用された回答

Star Strider
Star Strider 2020 年 4 月 29 日

0 投票

This plots the horizontal line:
polarplot(acos(pError)./asin(pError) * 0.05/max(pError), 'LineWidth',1) %horizontal line at 5% error
I am not sure how to scale it to be certain it meets the 5% criterion, since I am not certain what you are doing.
Another option:
polarplot(acos(pError-2*pi)./asin(pError-2*pi) * 0.05/max(pError), 'LineWidth',2) %horizontal line at 5% error
I defer to you for the proper scaling.
.

2 件のコメント

Christian Bellew
Christian Bellew 2020 年 4 月 29 日
Thank you!
Star Strider
Star Strider 2020 年 4 月 29 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePolar Plots についてさらに検索

製品

リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by