Path: news.mathworks.com!not-for-mail 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$1@fred.mathworks.com> References: <i9nuob$7pi$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1287624063 10570 172.30.248.38 (21 Oct 2010 01:21:03 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Thu, 21 Oct 2010 01:21:03 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:680002 "Ahmed Emad" <Ahmedkasrawy@gmail.com> wrote in message <i9nuob$7pi$1@fred.mathworks.com>... > 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