windell
Mechanical
- Jun 16, 2005
- 26
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
phi=monopole3D
r=monopole3D
%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),
[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.