How to draw a polar graph from r=0?
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, The following code draws the polar graph in the attachment. The problem is that this graph should begin at r=0, whereas it doesn't. I was told that I probably need to condition the data prior to plotting, yet there is no dependence on r in the function and anyhow I'm not sure how to go about it. I'd appreciate some guidance.
MagE=((cos((5*pi/4)*cos(theta*pi))-cos(5*pi/4))./sin(theta*pi)).^2;
MagEdB = 10*log10(MagE);
MagEdB = MagEdB - max(MagEdB);
MagEdB(MagEdB<-40) = -40;
h = polarplot(theta*pi,MagEdB+40,'Linewidth',3,'color',[.21 .81 .94]);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/158578/image.jpeg)
1 件のコメント
David Goodmanson
2016 年 12 月 2 日
Hello Yuval, Misha's answer below should solve your question, but I hope you don't mind a comment on the plots you have been doing.
I think there is a better way to go than plotting shifted data MagEdb+40 and then using a deliberately shifted grid to compensate, which is the
RTickLabel = {'-40','-30','-20','-10','0'}
approach from your question of 12 hours or so ago. Plotting the actual data MagEdb followed by
rlim([-40 0])
seems simpler and less error prone. (Your code above does not produce the plot above since the grid shift part is missing).
p.s. it works, but your choice of the variable to call theta seems a bit unconventional.
採用された回答
Mischa Kim
2016 年 12 月 2 日
Yuval, looks like you only need to increase the number of data points (theta):
theta = 0:0.001:2*pi;
or something like this.
3 件のコメント
Mischa Kim
2016 年 12 月 2 日
Well, after computing MagEdB for the first time you keep manipulating this term including
MagEdB(MagEdB<-30) = -30;
which cuts off all values below.
Why not use
theta = transpose(-1:0.001:1);
...
mylim = -40;
MagEdB(MagEdB<mylim) = mylim;
...
rlim([mylim 0])
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Polar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!