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:
using mesh to create 3D radiation pattern

Subject: using mesh to create 3D radiation pattern

From: Windell

Date: 10 Sep, 2009 12:48:02

Message: 1 of 2

I posted this question under another thread, however I think the activity went dry after I replied to a post. I'm reposting my question here to see if I can restart the get fresh sets of eyes.

I'm attempting to plot three columns contained in a txt file to a 3D plot that visually describes the radiation pattern of an antenna that I have tested. The three columns contain theta, phi, and power values. In my code I convert all the degree values to radians, then translate all the power values up so that they are all positive. Then I convert all the values from spherical to cartersian. From here I would like to create a 3D plot of my set of coordinates using the mesh command. However, I receive an error which is copied below.

I am not sure how to plot my data another way. I'm failry new to matlab so please forgive me if this is really trivial.

Much appreciated!
Windell


??? CData must be an M-by-N matrix or M-by-N-by-3 array.

Error in ==> mesh at 135
           hh = graph3d.surfaceplot(x,y,z,'FaceColor',fc,'EdgeColor','flat', ...

Error in ==> mesh3D at 19
mesh(X,Y,Z)

Here is my code...
%load & store the signal angle of attack values.
load monopole3D.txt
theta = monopole3D(:,1);
phi=monopole3D(:,2);
r=monopole3D(:,3);

%convert to radians.
theta=(pi/180)*theta;
phi=(pi/180)*phi;

%make the radius not negative.
r=r+40;

%convert spherical coordinates to rectangular coordinates.
[x,y,z]=sph2cart(theta,phi,r);
[X,Y,Z]=meshgrid(x,y,z);

%plot in 3D
mesh(X,Y,Z)

Subject: using mesh to create 3D radiation pattern

From: Rune Allnor

Date: 10 Sep, 2009 13:00:09

Message: 2 of 2

On 10 Sep, 14:48, "Windell " <windelljo...@gmail.com> wrote:
> I posted this question under another thread, however I think the activity went dry after I replied to a post. I'm reposting my question here to see if I can restart the get fresh sets of eyes.
>
> I'm attempting to plot three columns contained in a txt file to a 3D plot

Start out simple, to make sure you understand the voodoo
required to produce the desired plot from the given data.
Use a simple radiation pattern and make sure you understand
all the nuts'n bolts details in how to convert from a spherical
coordinate system to a rectangular system.

Rune

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