You need to subscript and save ‘Xx’ and ‘Xy’, I created ‘Xxv’ and ‘Xyv’ to do this, and also ‘tv’ to save the time vector if you need it.
This plots:
%model
k = 1;
while Xy >= 0
ax = awx;
Vx = Vx+dVx;
dVx = ax*dt;
Xx = Xx+dXx;
dXx = Vx*dt+0.5*ax*(dt)^2;
Xxv(k) = Xx;
ay = g+awy;
Vy = Vy+dVy;
dVy = ay*dt;
Xy = Xy+dXy;
dXy = Vy*dt+0.5*ay*(dt)^2;
Xyv(k) = Xy;
Vd = sqrt((Vx)^2+(Vy)^2);%sum of both speed vectors in flight
Fw = -0.5*ro*A*c*(Vd)^2;
theta = atan((Vx)/(Vy));%angle of Vd in fight
Fwy = cos(theta)*Fw;
Fwx = sin(theta)*Fw;
awx = (Fwx)/m;
awy = (Fwy)/m;
t = t+dt;
tv(k) = t;
k = k + 1;
end
plot(Xxv,Xyv)
xlabel('x (m)')
ylabel('y (m)')
title('Projectile Path')
You likely still have some work to do on this.
