MATLAB: How to transform this 2D animation into 3D

3d plotsanimationprojectile motion

I made this 2D animation of a projectile motion:
clc
clear all
h=input('Set high: ');
v0=input('Set initial speed: ');
N=input('Set angle: ');
hold on;
syms t
g = 9.80665;
rad=N*pi/180;
V0x=v0.*cos(rad);
V0y=v0.*sin(rad);
Y=h+(V0y*t)-(g/2*(t^2));
E=solve(Y,t);
t=0:0.008:double(E(2));
y=h+(V0y*t)-(g/2*(t.^2));
x=(V0x*t);
axis([x(1) x(end) min(y) max(y)])
for i=1:length(t)-1
comet(x(i:i+1),y(i:i+1))
pause(.05)
grid on
end
I need to transform the animation of this projectile motion into a 3D animation. What's the best way to do it? Thanks for your help.

Best Answer

See if the comet3 function will do what you want:
figure(1)
xlabel('X'), ylabel('Y'), title('Projectile motion')
comet3(t,w(:,3),w(:,1))
grid on
Related Question