×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Creating antenna radiation pattern in 3D

Creating antenna radiation pattern in 3D

Creating antenna radiation pattern in 3D

(OP)
Hi, I'm quite new to MATLAB and I am working on creating a 3D radiation pattern plot of an antenna that I am testing for a project. The purpose of the plot is really just to get a feel for the radiation pattern. I've already successfully created contour plots at various elevations by overlaying the data on a single plot.

As input I am reading three columns in from a txt file that contains the power level for each elevation and azimuth. I then convert from spherical to Cartesian coordinates and then attempt to make the 3D plot. Upon doing so, I get an error.

%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)

Second here is my error.
"Error in ==> meshgrid at 62
    zz = zz(ones(ny,1),ones(nx,1),:); Error in ==> v2_plot at 123
[X,Y,Z]=meshgrid(x,y,z);"

Any help would be greatly appreciated! I'm not sure why this isn't working really, but of course the error exist between the keyboard and chair. :)
  

RE: Creating antenna radiation pattern in 3D

probably be a bit of a clue if you told us which was line 123

I'm guessing this one

[X,Y,Z]=meshgrid(x,y,z);

which looks ok but without data etc it is hard to tell.

Cheers

Greg Locock

SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Creating antenna radiation pattern in 3D

(OP)
Hi Greg, Sorry about that. I moved the code to a separate file and ran it again. I received the following error.

??? 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)

I'm thinking that the problem has to do with not having all the data as matrices instead of vectors.

Thanks!

I attached the txt file and m-file.
http://files.engineering.com/getfile.aspx?folder=fe050b21-a721-481a-8ac8-a74fd710f106&;file=monopole3D.txt

http://files.engineering.com/getfile.aspx?folder=ee7e4477-db97-4448-a553-c6c4787da6ee&file=mesh3D.m

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources