MATLAB: Problem with Solid of revolution

3d plotssolid of revolutiontrigonometry

Hello,
I have a 2D function as shown in the curve below
, which I would like to revolve around x-axis using cylinder.
[X,Y,Z]=cylinder(y);
figure;surf(X,Y,Z);
xlabel('x');ylabel('y');zlabel('z');
So for the generated solid, x range should be 24-122 and both y and z axis range should be 0-~40. But I an getting something like the below solid.
I don't get why both x and y- axis ranges are the same and why z is varying from 0-1. What am I doing wrong? Ideally I should get an oval shaped solid and no sharp peak.
Thank you for the help.

Best Answer

That’s the default behaviour of the cylinder function. Use the rotate function to tip your customised cylinder on its side, and oriented in the direction you want.