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]);
  1 个评论
David Goodmanson
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
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
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])
Yuval
Yuval 2016-12-2
Perfect! Thank you so much, Mischa! Just one last thing (hopefully :-)) - is there a way to change all the numbers in this plot to latex?

请先登录,再进行评论。

更多回答(0 个)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by