Projectile Motion Simulation Projectile Write a MATLAB progr
Projectile Motion Simulation Projectile Write a MATLAB program to simulate and plot the projectile motion the motion of an object projected into the air at an angle. The object flies in the air until the projectile returns to the horizontal axis (x-axis), where y 0. This MATLAB program should allow the user to try to hit a 2-m diameter target on the x-axis (y 0) by varying conditions, including the lunch direction, the speed of the lunch, the projectile\'s size, and the location of the target. Plot the parabolic trajectory of each projectile simulation. Draw dots to mark the position of the projectile at second intervals. Add plot title, axis labels, and legends. Then, print computation results in the command window and analyze ifthe object hits the target or not. htt www.pbslearningmedia.or resource/hew06.sci.phys.maf.projmotio rojectile motion Score! FIRE Diameter Doo Angle ERASE
Solution
clc;
clear all;
close all;
a=2;
t=0:2*pi/50:2*pi;
x=a*sin(t);
l=length(x);
plot(x,\'r\');
delta=0.2;
hold on
xn=0;
for i=1:l;
if x(i)>xn(i)
d(i)=1;
xn(i+1)=xn(i)+delta;
else
d(i)=0; xn(i+1)=xn(i)-delta;
end
end
stairs(xn)
hold on
for i=1:d
if d(i)>xn(i)
d(i)=0;
xn(i+1)=xn(i)-delta;
else
d(i)=1; xn(i+1)=xn(i)+delta;
end
end
plot(xn,\'c\');
legend(\'Analog signal\',\'Delta modulation\',\'Demodulation\')
title(\'DELTA MODULATION / DEMODULATION \')
