Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How rotate a dscrete 2D curve around the Y axis for obtaining the surface?

Subject: How rotate a dscrete 2D curve around the Y axis for obtaining the surface?

From: Yung Olivier

Date: 18 Jun, 2010 14:00:21

Message: 1 of 2

Hey everybody:
   Now there is a 1×100 array,using plot(), we can get its curve, but how to obtain its surface with rotating around Y axis?
  Thank you very much!

Subject: How rotate a dscrete 2D curve around the Y axis for obtaining the surface?

From: Roger Stafford

Date: 18 Jun, 2010 23:54:04

Message: 2 of 2

"Yung Olivier" <gyolive@qq.com> wrote in message <hvfu5l$gg0$1@fred.mathworks.com>...
> Hey everybody:
> Now there is a 1×100 array,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

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us