Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!postnews.google.com!g6g2000vbr.googlegroups.com!not-for-mail
From: SaintPatrick <patrickmyu@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: strange error message
Date: Thu, 17 Sep 2009 20:11:58 -0700 (PDT)
Organization: http://groups.google.com
Lines: 29
Message-ID: <45341af6-364d-45e0-bcc2-3536c8ae52fe@g6g2000vbr.googlegroups.com>
References: <ec15a73f-76ad-4291-a568-b615d121e464@v36g2000yqv.googlegroups.com> 
	<h8kufa$i02$1@fred.mathworks.com>
NNTP-Posting-Host: 173.56.165.65
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1253243518 3267 127.0.0.1 (18 Sep 2009 03:11:58 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 18 Sep 2009 03:11:58 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: g6g2000vbr.googlegroups.com; posting-host=173.56.165.65; 
	posting-account=aBx39goAAABD4zA9ZQsEHPElelWvc6GR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) 
	Gecko/20090824 Firefox/3.5.3 GTB5,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:571243


On Sep 14, 4:22 am, "James Tursa"
<aclassyguy_with_a_k_not_...@hotmail.com> wrote:
> stpatryck <stpatr...@gmail.com> wrote in message <ec15a73f-76ad-4291-a568-b615d121e...@v36g2000yqv.googlegroups.com>...
> > Hello Folks,
>
> > I typed in these commands:
> > >> t=0:0.01:2*pi;s=t;
> > >> x=cos(t).*cos(s);y=cos(t).*sin(s);z=sin(t);
> > >> surf(x,y,z)
>
> > I got the following error message:
>
> > ??? Error using ==> surf at 78
> > Z must be a matrix, not a scalar or vector.
>
> > What am I doing wrong???
>
> Amazingly enough, the error message means exactly what it says! Your x and y inputs to surf form a mesh, and z forms the height at each mesh point. i.e., each combination of an x element and a y element needs to have a z element. So if x is an n-vector and y is an m-vector, then Z needs to be a m-by-n matrix.
>
> James Tursa

I don't understand -- z shows up in the workspace as a matrix with the
same dimensions as x and y.  Since t is a matrix, z = sin(t) should
also be a matrix.