Make a polar plot from data

I am trying to make a polar plot of a set of data in file called 't8m'. I am calculating parameters as:
  1. theta angle = arccos (column 4)
  2. bin width = 10 (making a total of 18 bins between 0 and 180deg).
  3. length of each bin should be = (number of the theta angles that fall in the bin)/total number of all angles between 0 and \pi. This can be seen as length of array within the bin/length of array in that frame.
I am having problems with the for loop and the polar plot command. Can someone help out with this loop? Here is what I have now:
izm=length(t8m)
theta = acosd(nz) ;
for i = drange(0:10:180)
k= 0.0
for j = 1:izm
if theta == i
k = k+1
lth1 = k/length(k)
end
end
end
polar(theta,lth1,'--r')

 Respuesta aceptada

Thorsten
Thorsten el 12 de Feb. de 2013

0 votos

theta = pi*rand(1, 100);
th = linspace(pi/10, pi, 10);
hi = hist(theta, th);
polar(th, hi/numel(theta))

2 comentarios

kayak
kayak el 13 de Feb. de 2013
Thanks Thorsten, but now I don't get it. It seems you replaced the theta calculation (theta = acos (nz)) completely. I still want the angle to be calculated as arccos, but the scaling should be between 0 and 1.
Thorsten
Thorsten el 13 de Feb. de 2013
Editada: Thorsten el 13 de Feb. de 2013
Sorry for the confusion. I just generated some sample data (because I do not have nz), using
theta = pi*rand(1, 100);
Of course you have to use
theta = acos(nz);

Iniciar sesión para comentar.

Más respuestas (1)

Thorsten
Thorsten el 11 de Feb. de 2013
Editada: Thorsten el 11 de Feb. de 2013

0 votos

theta = acos(nz);
rose(theta)

3 comentarios

kayak
kayak el 11 de Feb. de 2013
thanks Thorsten, but my major problem is how to do the loop for sorting into the angle categories. Does anyone have an idea about this?
Thorsten
Thorsten el 11 de Feb. de 2013
Editada: Thorsten el 11 de Feb. de 2013
Hi Kayak, rose is an angular histogram that does the sorting for you, if theta is a bunch of angles in radiant.
kayak
kayak el 12 de Feb. de 2013
Thanks, I get it now. After using the command:
rose(theta, 18),
I want to scale this with the length of the whole array (ie length (theta))so that the bar length lies between 0 and 1. Do you know how I can do this? I have tried plotting:
rose ((theta/length(theta)), 18)
but this is showing only one bar. Can someone help please.

Iniciar sesión para comentar.

Categorías

Más información sobre Polar Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 11 de Feb. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by