Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: using mesh to make 3D plot
Date: Wed, 24 Apr 2013 10:29:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 68
Message-ID: <kl8c5m$pgq$1@newscl01ah.mathworks.com>
References: <h859vn$802$1@fred.mathworks.com> <h85j7a$dkh$1@fred.mathworks.com> <h86sol$1h9$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1366799350 26138 172.30.248.37 (24 Apr 2013 10:29:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 24 Apr 2013 10:29:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 4260511
Xref: news.mathworks.com comp.soft-sys.matlab:794221

"Windell " <windelljones@gmail.com> wrote in message <h86sol$1h9$1@fred.mathworks.com>...
> Thanks for your reply Wayne! Just tried what you suggested and I'm still receiving an error. 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)
> 
> The error I'm getting is the following: "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);"
> 
> Much Appreciated
> Windell
> 
> "Wayne King" <wmkingty@gmail.com> wrote in message <h85j7a$dkh$1@fred.mathworks.com>...
> > "Windell " <windelljones@gmail.com> wrote in message <h859vn$802$1@fred.mathworks.com>...
> > > Hi,
> > > 
> > > I'm attempting to plot a 3D radiation pattern of an antenna that I tested. I stored all the power levels at different azimuths and elevations in a txt file. I convert my results to rectangular coordinates using the sph2cart function and I attempt to mesh the data to create a 3D plot. In doing so I received an error: "Warning: Z must not be a scalar or vector, not rendering surface." I'm new to plotting in 3D in matlab so I'm not sure what I should do from here. I would greatly appreciate your help!
> > > 
> > > Thanks for your time!
> > > Windell
> > > 
> > > %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);
> > > figure;
> > > %plot in 3D
> > > mesh(X,Y,Z)
> > Hi Windell, mesh() is expecting that at least your Z argument is a matrix. I would suggest using meshgrid(). 
> > 
> > >>doc meshgrid
> > 
> > to convert your X,Y,Z outputs to matrices amenable to calling mesh().
> > 
> > Hope that helps,
> > wayne


Hi windell
i have the same issue. have you find any solution?
best regards
Christian