2D plot in 3D polar graph

2019-08-14 02:31发布

问题:

I would like to plot a 3D graph, y=100-x^2, cycle around the Y axis in 360 degrees. Eventually to become like a cone. Is that possible? I have an array x=1:1:100, and an array y, size(1 100).

I tried an Z array, z=1:1:100 as the 3th axis in the base of the cone. With plot3 I done the one graph of y=100-x^2. I would like to kinda animate it and have eventually a cone, or a surface cone.

回答1:

Is this what you are looking for?

r = 1:1:100;
y = 100-r.^2;
theta = 0:pi/20:2*pi;
xx = bsxfun(@times,r',cos(theta));
zz = bsxfun(@times,r',sin(theta));
yy = repmat(y',1,length(theta));
surf(xx,yy,zz)

Source: Generating a 3D plot by revolution of a curve