How to draw a polar graph from r=0?
조회 수: 6 (최근 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
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!
