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:
3D Polar surface Plots

Subject: 3D Polar surface Plots

From: Joseph

Date: 9 Dec, 2008 05:09:02

Message: 1 of 5

I have spherical data consisting of the amplitude or radius as a function of theta and phi, i.e: R(theta,phi). I want to plot this data as a surface or contour. I tried the polarplot3D function from the File exchange and it didn't give me the results for which I was looking. I then attempted to convert from the spherical coordinates to cartesian coordinates, but the plot looked just like the plot output from the polarplot3D function (surf(X,Y,R) The data rotates about the Z axis correctly, like the azimuth (phi) is being plotted polarly, but the surface sits above the xy plane, i.e. the elevation (theta) isn't being plotted polarly. I want every value in R to be plotted as the amplitude of a radius from the origin. I haven't yet attempted to

The application is plotting the beampattern of an array antenna, if that helps visualize what I'm trying to accomplish.

Subject: 3D Polar surface Plots

From: alain boyer

Date: 9 Dec, 2008 06:02:02

Message: 2 of 5

"Joseph " <joey_m@live.com> wrote in message <ghkuhe$du9$1@fred.mathworks.com>...
> I have spherical data consisting of the amplitude or radius as a function of theta and phi, i.e: R(theta,phi). I want to plot this data as a surface or contour. I tried the polarplot3D function from the File exchange and it didn't give me the results for which I was looking. I then attempted to convert from the spherical coordinates to cartesian coordinates, but the plot looked just like the plot output from the polarplot3D function (surf(X,Y,R) The data rotates about the Z axis correctly, like the azimuth (phi) is being plotted polarly, but the surface sits above the xy plane, i.e. the elevation (theta) isn't being plotted polarly. I want every value in R to be plotted as the amplitude of a radius from the origin. I haven't yet attempted to
>
> The application is plotting the beampattern of an array antenna, if that helps visualize what I'm trying to accomplish.

So you have something like theta, phi and dBi? Ok just define an isotropic meshgrid and gridfit your data onto it allowing the radius to distort with the data, convert to cartesian and surf. You can encode link budget gain value and margin into the colormap, normalize the colormap to a range of desired values or use min/max gain as colormap extremes. I often encode mpeg movies of these surface plots with a simple azimuth 360 rotation.

Subject: 3D Polar surface Plots

From: Joseph

Date: 11 Dec, 2008 02:57:03

Message: 3 of 5

"alain boyer" <nospam@nospam.com> wrote in message <ghl1kq$6ka$1@fred.mathworks.com>...
> "Joseph " <joey_m@live.com> wrote in message <ghkuhe$du9$1@fred.mathworks.com>...
> > I have spherical data consisting of the amplitude or radius as a function of theta and phi, i.e: R(theta,phi). I want to plot this data as a surface or contour. I tried the polarplot3D function from the File exchange and it didn't give me the results for which I was looking. I then attempted to convert from the spherical coordinates to cartesian coordinates, but the plot looked just like the plot output from the polarplot3D function (surf(X,Y,R) The data rotates about the Z axis correctly, like the azimuth (phi) is being plotted polarly, but the surface sits above the xy plane, i.e. the elevation (theta) isn't being plotted polarly. I want every value in R to be plotted as the amplitude of a radius from the origin. I haven't yet attempted to
> >
> > The application is plotting the beampattern of an array antenna, if that helps visualize what I'm trying to accomplish.
>
> So you have something like theta, phi and dBi? Ok just define an isotropic meshgrid and gridfit your data onto it allowing the radius to distort with the data, convert to cartesian and surf. You can encode link budget gain value and margin into the colormap, normalize the colormap to a range of desired values or use min/max gain as colormap extremes. I often encode mpeg movies of these surface plots with a simple azimuth 360 rotation.
>
So I have B(el,az) el=[1 x A] az=[1 x A] and B=[A x A].
my code:
[el_m az_m]=meshgrid(el,az);
g=gridfit(el_m,az_m,B,el,az)
[x y z] = sph2cart(el_m,az_m,g)
surf(x,y,z)
This doesn't give me the surface I'm looking for.

I have had success manually converting el,az, and B into x,y, and z, each [1xAsquared] and then running plot3(x,y,z). This basically plots a curve that traces the surface I wish to plot. I was experimenting with the sphere function, [x y z ] =sphere(n), then [th,ph,R]=cart2sph(x,y,z), then changing various R values, sph2cart, then surf(x,y,z). That seemed like it might work, but I haven't gotten to trying it w/ my data yet.

Subject: 3D Polar surface Plots

From: Walter

Date: 4 Sep, 2009 05:01:05

Message: 4 of 5

i think the answer is

surf (x,y,z,g); % if g is the interpolatet radius

works at my actual project

Subject: 3D Polar surface Plots

From: Luigi Giaccari

Date: 4 Sep, 2009 12:09:02

Message: 5 of 5

"Joseph " <joey_m@live.com> wrote in message <ghkuhe$du9$1@fred.mathworks.com>...
> I have spherical data consisting of the amplitude or radius as a function of theta and phi, i.e: R(theta,phi). I want to plot this data as a surface or contour. I tried the polarplot3D function from the File exchange and it didn't give me the results for which I was looking. I then attempted to convert from the spherical coordinates to cartesian coordinates, but the plot looked just like the plot output from the polarplot3D function (surf(X,Y,R) The data rotates about the Z axis correctly, like the azimuth (phi) is being plotted polarly, but the surface sits above the xy plane, i.e. the elevation (theta) isn't being plotted polarly. I want every value in R to be plotted as the amplitude of a radius from the origin. I haven't yet attempted to
>
> The application is plotting the beampattern of an array antenna, if that helps visualize what I'm trying to accomplish.

In cartesian coordinates you can use the convhulln function to tessellate your points.
Then the trisurf to plo it.

http://www.advancedmcode.org

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