How to draw a polar graph from r=0?
    7 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
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 Kommentar
  David Goodmanson
      
      
 am 2 Dez. 2016
				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.
Akzeptierte Antwort
  Mischa Kim
    
      
 am 2 Dez. 2016
        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 Kommentare
  Mischa Kim
    
      
 am 2 Dez. 2016
				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])
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Polar Plots finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
