COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Plotting 3D spherical coordinates

• Email
• Follow

```Hi there,

I'm attempting to plot a 3D radiation pattern. For that I have the Azimuth (phi) angles (0..360) with 5 degree steps and the Elevation (theta) angles (0..180) with values in angles 0, 30, 45, 60, 90, 120, 135, 150, 180. And the gain I want to represent, meaning the radius.

Right now my code gets semi-nice results and it basically does:
F = TriScatteredInterp (phi, theta, gain);
g = F(Az, El);

where Az and El come from
[Az El] = meshgrid(0:5:360,0:5:360);

Then I transform from spherical coordinates to cartesian and plot using surf.

If I try to plot without interpolating the points then Matlab gives an error because surf needs matrix as imputs instead of vectors.

So do you know any other way of ploting the radiation pattern as a surface?

Thank you!
```
 0

See related articles to this posting

```"Anabel " <anabel.perezdiaz@tut.fi> wrote in message <i240hk\$8a2\$1@fred.mathworks.com>...
> Hi there,
>
> I'm attempting to plot a 3D radiation pattern. For that I have the Azimuth (phi) angles (0..360) with 5 degree steps and the Elevation (theta) angles (0..180) with values in angles 0, 30, 45, 60, 90, 120, 135, 150, 180. And the gain I want to represent, meaning the radius.
>
> Right now my code gets semi-nice results and it basically does:
> F = TriScatteredInterp (phi, theta, gain);
> g = F(Az, El);
>
> where Az and El come from
> [Az El] = meshgrid(0:5:360,0:5:360);
>
> Then I transform from spherical coordinates to cartesian and plot using surf.
>
> If I try to plot without interpolating the points then Matlab gives an error because surf needs matrix as imputs instead of vectors.
>
> So do you know any other way of ploting the radiation pattern as a surface?
>
> Thank you!

You may plot this surface simpler. You should make three matrices which contains phi, theta and R. All three matrices must be same dimensions. Then use sph2cart and then use surf.
```
 0

```"Sergey Holmogorov" <holmogorov@kstu-kai.ru> wrote in message <i2mmjp\$4bh\$1@fred.mathworks.com>...
> "Anabel " <anabel.perezdiaz@tut.fi> wrote in message <i240hk\$8a2\$1@fred.mathworks.com>...
> > Hi there,
> >
> > I'm attempting to plot a 3D radiation pattern. For that I have the Azimuth (phi) angles (0..360) with 5 degree steps and the Elevation (theta) angles (0..180) with values in angles 0, 30, 45, 60, 90, 120, 135, 150, 180. And the gain I want to represent, meaning the radius.
> >
> > Right now my code gets semi-nice results and it basically does:
> > F = TriScatteredInterp (phi, theta, gain);
> > g = F(Az, El);
> >
> > where Az and El come from
> > [Az El] = meshgrid(0:5:360,0:5:360);
> >
> > Then I transform from spherical coordinates to cartesian and plot using surf.
> >
> > If I try to plot without interpolating the points then Matlab gives an error because surf needs matrix as imputs instead of vectors.
> >
> > So do you know any other way of ploting the radiation pattern as a surface?
> >
> > Thank you!
>
> You may plot this surface simpler. You should make three matrices which contains phi, theta and R. All three matrices must be same dimensions. Then use sph2cart and then use surf.

The thing is that I don't know how to create phi, theta and R as matrices... Thats why I used the interpolation. I accept Ideas for that
And yes... I used sph2cart and it didn't work properly so I had to make the coversion by my own.
```
 0

2 Replies
835 Views

Similar Articles

11/30/2013 5:52:54 PM
page loaded in 48623 ms -0