Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Polar plot with dB scale

Subject: Polar plot with dB scale

From: Jennifer Cohen

Date: 6 Aug, 2007 13:10:28

Message: 1 of 14

I am trying to plot radiation patterns for antennas on a
polar plot. Any ideas how I can convert the rho axis to a
log scale? Im using version 6.5

Subject: Polar plot with dB scale

From: Chi Zhang

Date: 29 Oct, 2007 23:45:13

Message: 2 of 14

I want to know the answer as well, anyone can help?

Subject: Polar plot with dB scale

From: Chi Zhang

Date: 29 Oct, 2007 23:49:37

Message: 3 of 14

I want to know the answer too, anyone help please?

Subject: Polar plot with dB scale

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 30 Oct, 2007 00:03:48

Message: 4 of 14

In article <f976k4$j8k$1@fred.mathworks.com>,
Jennifer Cohen <j_co50@hotmail.com> wrote:
>I am trying to plot radiation patterns for antennas on a
>polar plot. Any ideas how I can convert the rho axis to a
>log scale? Im using version 6.5

You can't. If you did, then your plot would have to become infinitely
large in order to accomedate the polar pole which is always
at radius 0 (log of which is negative infinity.)
--
  "There are some ideas so wrong that only a very intelligent person
  could believe in them." -- George Orwell

Subject: Polar plot with dB scale

From: Chi Zhang

Date: 30 Oct, 2007 00:12:08

Message: 5 of 14

Hi Roberson, thank you for replying so quickly! I think I
didn't state the problem clearly: it is the axis I want to
change, not the plot itself. Actually I want my plot's rho
scale to be (from out-side most circle in) 0dB, 10dB,
20dB,and 30dB, instead of the linear scale (from inside out)
0, 2, 4, 6, 8, 10. Thanks a lot for anyone helps, really
really appreciate it!!!

Subject: Polar plot with dB scale

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 30 Oct, 2007 03:09:11

Message: 6 of 14

In article <fg5sso$se2$1@fred.mathworks.com>,
Chi Zhang <ela04cz@gmail.com> wrote:
>Hi Roberson, thank you for replying so quickly!

'Roberson' is my family name; my given name is 'Walter'.

>I think I
>didn't state the problem clearly: it is the axis I want to
>change, not the plot itself. Actually I want my plot's rho
>scale to be (from out-side most circle in) 0dB, 10dB,
>20dB,and 30dB, instead of the linear scale (from inside out)
>0, 2, 4, 6, 8, 10. Thanks a lot for anyone helps, really
>really appreciate it!!!

polar(1:10,1:10);
set(findobj(gca, 'String', ' 10'),'String', '0 dB');
set(findobj(gca, 'String', ' 8'),'String', '10 dB');
set(findobj(gca, 'String', ' 6'),'String', '20 dB');
set(findobj(gca, 'String', ' 4'),'String', '30 dB');
set(findobj(gca, 'String', ' 2'),'String', '40 dB');

To automate this more, you can find out what the strings
are that you need to replace:

yticks = get(gca,'YTick');
yticklabs = get(gca,'YTickLabel');
activelabs = cellstr(yticklabs(yticks>0,:));
numlabs = length(activelabs);
for K=1:numlabs
  set(findobj(gca, 'String', [' ' activelabs{K}]), ...
      'String', num2str(10*(numlabs-K),'%d dB'));
end


I don't promise that the pattern will always be two spaces followed
by the tick label; that was the pattern in the tests I did.
--
   "No one has the right to destroy another person's belief by
   demanding empirical evidence." -- Ann Landers

Subject: Polar plot with dB scale

From: Chi Zhang

Date: 2 Nov, 2007 17:39:38

Message: 7 of 14

Hi,thank you so much for helping. I tried the code you
suggested, instead of giving flower petals like radiation
pattern, it gave me some spirals...I think it might just be
a small trick, as all I want to do is to change the linear
polar plot into semi log polar plot, just as people can
change x(linear)-y(linear)plot into x(linear)-y(log)plot, by
typing 'semilog'.I have checked website and help doc I got,
no answer found. Any ideas?

Subject: Polar plot with dB scale

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 2 Nov, 2007 20:47:17

Message: 8 of 14

In article <fgfncq$pni$1@fred.mathworks.com>,
Chi Zhang <ela04cz@gmail.com> wrote:
>Hi,thank you so much for helping. I tried the code you
>suggested, instead of giving flower petals like radiation
>pattern, it gave me some spirals...

You said, "I want the axis to change, not the plot itself".
So the code doesn't change the plot, just how the plot is labelled.

If you are getting spirals and you want flower petals, then it
is likely that you need a log() taken at some point. So use the
code I provided and pass in the log() of your current rho data.


>I think it might just be
>a small trick, as all I want to do is to change the linear
>polar plot into semi log polar plot, just as people can
>change x(linear)-y(linear)plot into x(linear)-y(log)plot, by
>typing 'semilog'.I have checked website and help doc I got,
>no answer found. Any ideas?

No, it isn't just "a small trick". Matlab does not support
semi-log plots; as I pointed out in another posting in this thread,
doing so would require an infinite plot because of the infinity
of log(x) where x is 0 to 1. The best you can do is trick polar()
to relabel the concentric circles.

Within the last few days I have been in contact with Mathworks support
on the issue of using log() and polar() [I found a some bugs in the polar
plotting routines], and the official word from them is that there is
no support for log polar plots.
--
  "All is vanity." -- Ecclesiastes

Subject: Polar plot with dB scale

From: Markus Buehren

Date: 2 Nov, 2007 22:38:28

Message: 9 of 14

Use mmpolar from the file exchange!

Markus

Subject: Polar plot with dB scale

From: zarreen

Date: 19 Jun, 2008 10:39:02

Message: 10 of 14

"Jennifer Cohen" <j_co50@hotmail.com> wrote in message
<f976k4$j8k$1@fred.mathworks.com>...
> I am trying to plot radiation patterns for antennas on a
> polar plot. Any ideas how I can convert the rho axis to
a
> log scale? Im using version 6.5

Subject: Polar plot with dB scale

From: Andres Romero

Date: 5 May, 2010 11:15:21

Message: 11 of 14

Hi, I had the same problem but I figured out a way to solve it:
Linear values below 0 are negative values in the logarithmic scale, so polar plot takes the absolute value instead.
If you want a logarithmic plot of a function x(theta) in a logarithmic scale that goes between -40 and 0 dB you should write

polar(theta,40-10*log10(x))

Your polar plot will then have values between 0 and 40. You can then manually change the value of 40 to 10dB (edit plot, double click in the 0 value)

Subject: Polar plot with dB scale

From: Florian

Date: 27 Dec, 2011 21:13:08

Message: 12 of 14

"Jennifer Cohen" <j_co50@hotmail.com> wrote in message <f976k4$j8k$1@fred.mathworks.com>...
> I am trying to plot radiation patterns for antennas on a
> polar plot. Any ideas how I can convert the rho axis to a
> log scale? Im using version 6.5


1) converting the function in log
2)calculating the amplitude at -10db, -20db, -30db etc...
3)Dividing by the max in log of the function
4)ploting in polar
5)editing the plot and removing the linear axes (with matlab directly on the figure)
6)editing the values of the axes in dB on the plot (with matlab directly on the figure)


My code :
%-3dB
for j=1:100
db3(j)=20*log10(max(averagetab)/2);
end

%-10dB
for j=1:100
db10(j)=20*log10(max(averagetab)/3.16);
end

%-20dB
for j=1:100
db20(j)=20*log10(max(averagetab)/10);
end

%-30dB
for j=1:100
db30(j)=20*log10(max(averagetab)/30);
end




%Decibel conversion
for j=1:lgth
if(averagetab(j)>1)
averagetab(j)=20*log10(averagetab(j));
else
    averagetab(j)=0;
end
end


%Normalizing to 0dB
db3=db3/(max(averagetab));
db10=db10/(max(averagetab));
db20=db20/(max(averagetab));
db30=db30/(max(averagetab));
averagetab=averagetab/(max(averagetab));

phi = linspace(0,2*pi,100);

......


figure(2)

polar(f,v,'r')
hold
polar(phi,db3)


polar(phi,db10,'black--')
polar(phi,db20,'black--')
polar(phi,db30,'black--')

%Cheeeeersss

Subject: Polar plot with dB scale

From: Sahin

Date: 6 Apr, 2014 22:21:11

Message: 13 of 14

Hi. I'm nearly new at matlab and i drew this figure:
theta=linspace(0,2*pi);
r=cos(theta);
polar(theta,40+10*log10(r))
Now, I need to turn this graphic 90 degree through left. I mean that zero degree should be on the top, not on the right anymore. Adding pi/2 degree to the theta is an option, but I want "zero degree symbol" to be on the top. All degrees should be shifted 90 degree.

Also I want dB in order of 40-30-20-10-0 (not 0-10-20-30-40). Editing them by hand is an option. I wonder if there's a code I can simply do that easier.
Thanks for your attention..

Subject: Polar plot with dB scale

From: Kelly Kearney

Date: 7 Apr, 2014 15:20:12

Message: 14 of 14

"Sahin" wrote in message <lhsk0n$l88$1@newscl01ah.mathworks.com>...
> Hi. I'm nearly new at matlab and i drew this figure:
> theta=linspace(0,2*pi);
> r=cos(theta);
> polar(theta,40+10*log10(r))
> Now, I need to turn this graphic 90 degree through left. I mean that zero degree should be on the top, not on the right anymore. Adding pi/2 degree to the theta is an option, but I want "zero degree symbol" to be on the top. All degrees should be shifted 90 degree.
>
> Also I want dB in order of 40-30-20-10-0 (not 0-10-20-30-40). Editing them by hand is an option. I wonder if there's a code I can simply do that easier.
> Thanks for your attention..

I've found mmpolar to be pretty good for any polar plot customization:

http://www.mathworks.com/matlabcentral/fileexchange/38855-comprehensive-polar-plots

-Kelly

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us