Please help me correct my MATLAB script code for this problem, thank you!!
MATLAB CODE----------------------------------------------------------------------------------------------------
%% this program ghaphs the trajectory of two projectiles
% Angles are in degrees, time is in seconds & distances are in metres
VoA=600;
ThetaA=40;
h=0;
VoB=800;
ThetaB=(180/pi)*asin(VoA*sind(ThetaA)/VoB)
Time_of_flight_A_to_B=2*VoA*sind(ThetaA)/9.81
Distance_from_A_to_B=VoA*cosd(ThetaA)*Time_of_flight_A_to_B
Time_of_intercept=(Distance_from_A_to_B)/(VoA*cosd(ThetaA)+VoB*cosd(ThetaB))
Xc=VoA*cosd(ThetaA)*Time_of_intercept
Yc=VoA*sind(ThetaA)*Time_of_intercept-(0.5*9.81*Time_of_intercept^2)
x=[-200:10:200];
for i=1:41
ya(i)=h-4.9*(x(i)/(VoA*cosd(ThetaA))).^2+tand(ThetaA);
yb(i)=h-4.9*(x(i)/(VoB*cosd(ThetaB))).^2+tand(ThetaB);
end
x=[-200:10:200];
plot(x,ya,'x')
hold on
plot(x,yb,'o')
xlabel('Distances in metres')
ylabel('Distances in metres')
legend('Pa','Pb')
hold off
OUTPUT--------------RESULT------------------------------------------------------------------------
ThetaB = 28.822 Time_of_flight_A_to_B = 78.628 Distance_from_A_to_B = 3.6140e+04 Time_of_intercept = 31.141 Xc = 1.4313e+04 Yc = 7253.5
Please help me correct my MATLAB script code for this problem, thank you!! A projectile PA is launched from point A towards the east with an initial launch velocity voa and an initial...
1 2 A projectile PA is launched from point A towards the east with an initial launch velocity ves and an initial launch angle of 8aA. The impact point of the projectile Pa is a point B in a valley with an ordinate, you, located below the elevation of point A. The launch from point A is instantaneously detected at point B, and a counter projectile Pa ts launched simultaneously towards the west to intercept the incoming projectile PA. Projectile...