I\'m trying to revolve a 2D curve to generate a 3D surface plot.
I\'ve tried using
[X,Z,Y] = cylinder(u);
surf(X,Y,Z), axis square
th
To rotate the axis of the cylinder, you can simply change the order of X, Y, and Z.
[X,Y,Z] = cylinder(u);
surf(X,Y,Z) %# rotation around Z
surf(Z,X,Y) %# rotation around X
surf(Y,Z,X) %# rotation around Y
EDIT
To change the axis of rotation of your curve, you have to calculate the surface. For example, to rotate y = sin(alpha)
with alpha = 0:0.1:pi
around the y-axis, you can write
r = 0:0.1:pi;
z = sin(r);
theta = 0:pi/20:2*pi;
xx = bsxfun(@times,r',cos(theta));
yy = bsxfun(@times,r',sin(theta));
zz = repmat(z',1,length(theta));
dfig,surf(xx,yy,zz)
axis equal