MATLAB 2D plot parabolic line rotation to form a cone in 3D
Question
I would like to make a cone surface plot using: the distance vector 'X=1:1:100' (size 1 100) and the data vector Y=1:1:100 (size 1 100). In 2D the plot is a kinda parabolic equation 'Y=100-X^2' ( y > 0 and -a < x < +a ).
I would like to rotate the line plot by 180 degrees, with step every 1 degree, around x=0(y axis), forming a cone in 3d space. Is it possible? Please, any idea is more than welcome.
Solution
This 3D polar plot from the Mathworks website is probably what you're looking for:
http://www.mathworks.com/matlabcentral/fileexchange/13200-3d-polar-plot
It looks like a pretty sweet function. Note the 'Angular Range' property described.
But you can also get what you want without it:
figure(); hold on;
for theta = linspace(0, pi, 100) % Not exactly sure how you want to vary theta
[T, R] = meshgrid(linspace(0, theta, 100), 1:100);
[X, Y] = pol2cart(T,R);
Z = 100 - R.^2; % Compute the surface of revolution
surf(X,Y,Z); % Plot the surface
pause(1); % Wait one second
end
Let me know if this isn't what you're describing, or if you need more help.