From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Plotting 3d planes
Date: Thu, 21 Oct 2010 01:21:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <i9o4hv$aaa$>
References: <i9nuob$7pi$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1287624063 10570 (21 Oct 2010 01:21:03 GMT)
NNTP-Posting-Date: Thu, 21 Oct 2010 01:21:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:680002

"Ahmed Emad" <> wrote in message <i9nuob$7pi$>...
> hi,
> I am trying to plot a 3D plane in matlab using the surf command.
> I have calculated the plane's equation using 3 points (to be input upon activation of the program). the equation is as follows:
>                  Ps= a + u*L1+ v*L2;
> where
>                  [L1]= b-a;
>             &   [L2]= c-b;
> and u and v are varying quantities.
> When I try to use the surf command as follows:
>                   surf (Ps, 'DisplayName', 'Ps'); figure(gcf)
> i get the following error
>                  Error using ==> surf at 78
>                  Z must be a matrix, not a scalar or vector.
> Can someone please tell me what I am doing wrong? 
> thanks in advance
- - - - - - - - -
  You haven't said how you handled the 'u' and 'v' parameters.  Based on the error message you received I would guess that you let each one be a vector.  That wouldn't work.  It would correspond to traveling along some straight line on your plane.  You want 'u' and 'v' to vary independently so you cover a two-dimensiona piece of your plane.  That is what the 'meshgrid' function can do for you.  It produces matrices rather than vectors.  Check it out.

Roger Stafford