Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How rotate a dscrete 2D curve around the Y axis for obtaining the surface?
Date: Fri, 18 Jun 2010 23:54:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <hvh0us$bj9$1@fred.mathworks.com>
References: <hvfu5l$gg0$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1276905244 11881 172.30.248.35 (18 Jun 2010 23:54:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 18 Jun 2010 23:54:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:646312

"Yung Olivier" <gyolive@qq.com> wrote in message <hvfu5l$gg0$1@fred.mathworks.com>...
> Hey everybody:
>    Now there is a 1×100 array&#65292;using plot(), we can get its curve, but how to obtain its surface with rotating around Y  axis?
>   Thank you very much!

  If you were plotting an x-array against a y-array, then you can do this:

 n = 100;
 [rho,theta] = meshgrid(x,linspace(0,2*pi,n));
 Z = repmat(y(:).',n,1);
 X = rho.*cos(theta);
 Y = rho.*sin(theta);
 surf(X,Y,Z)

In the surface here the curve will be rotated about the z-axis of the three-dimensional surf space.

  If instead you were plotting y against its own index, just use x = 1:m in the above where m is the length of y.

Roger Stafford