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. :)
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
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
??? 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://fi
htt