how to color the area under the line??

2 ビュー (過去 30 日間)
ahmed allaheani
ahmed allaheani 2016 年 12 月 10 日
回答済み: Nirav Sharda 2016 年 12 月 13 日
i am using polar coordinates to plot an antenna coverage area shape. i got the code as following:
and i got the result :
i just need help at [ how can i shad or color the area under the curve ????]
  2 件のコメント
Image Analyst
Image Analyst 2016 年 12 月 10 日
It's not clear what area you're referring to. If you mean between the line and the center, then it seems that some points are "inside" 3 curves or 4 curves. So do you count that area 3 times or 4 times or just once?
ahmed allaheani
ahmed allaheani 2016 年 12 月 11 日
yes I am referring to the area between the line and the center. i count it only once
thanx

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

採用された回答

Nirav Sharda
Nirav Sharda 2016 年 12 月 13 日
You can use the patch function here. I picked up 2 adjacent points and the center and created a patch inside a for loop. Also I used 'polar' instead of 'polarplot', because patch cannot be used for polaraxes.
r = [-18,-23,-29,-30,-30,-27,-24,-22,-32,-32,-30,-30,-24,-22,-25,-15,-20,-22,-27];
theta = linspace(-180,180,length(r));
polar(theta,r);
[x y]= pol2cart(theta,r);
for i = 1:length(r)-1
x1 = [x(i) x(i+1) 0];
y1 = [y(i) y(i+1) 0];
patch(x1,y1,'r','EdgeColor','none');
end
% This can be optional. I added this so that the numbers 10 and 20 are
% visible
alpha(.1);
I hope this helps.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by