calculate the flight path of a projectile with and without a
calculate the flight path of a projectile with and without air resistance. For simplification, we will assume that the projectile is small and spherical in shape. Your task is to write a MATLAB programs that calculate the flight path, range and flight time for several values of coefficients of resistance of the projectile, and plot the results.
coeficient of resistance= 0-.08 with step size of .001
initial velocity=600
release angle =60
If we assume that the projectile is launched from the surface of the Earth, i.e., at y0 = 0, then the altitude of the projectile as a function of time is
Y(t)=(-1/2)*g*t^2 +Vt;
where g = 9.81 m/s2 is the gravitational constant, t is time (in seconds), and V = v0 sin (in meters per second). The distance of the projectile from the launching position as a function of time is
x(t)=U*t
where U = v0 cos . The velocity of the projectile in the horizontal direction, i.e., parallel to the x-axis, is
u(t)=U
and the velocity in the vertical direction, i.e., parallel to the y-axis, is
v(t)=-gt+V
If we include the effects of air resistance, then the altitude of the projectile as a function of time can be approximated as
y(t)=-gt/k+((kV+g)/k^2)*(1-e^(-kt))
where k is the coefficient of resistance (with the unit 1/s). The distance of the projectile relative to the initial position as a function of time is
x(t)=(u/k)(1-e^(-kt))
The velocity of the projectile in the horizontal direction is
u(t)=ue^(-kt)
and in the vertical direction
v(t)=Ve^(kt)+(g/k)*(e^(-kt)-1)
create
1. A MATLAB function, flightpath.m, capable of calculating the flight path of a projectile, with and without air resistance, given an initial speed v0, an angle of departure relative to the horizontal, and a coefficient of resistance k.
2. A script, main_flightpaths.m, which uses the function flightpath.m to calculate and the function plot_flightpaths.m to plot the following: a. Altitude, y, as a function of distance, x (see Fig. 2) b. Altitude, y, as a function of time, t c. Horizontal velocity, u, as a function of time, t d. Vertical velocity, v, as a function of time, t For these plots, assume v0 = 600 m/s, = 60 deg., and k = [0 0.005 0.01 0.02 0.04 0.08] s-1 .
3. A script, main_range.m, which uses the function flightpath.m to calculate and function plot_range.m to plot the following: a. Range as a function of k b. Total flight time as a function of k For these plots, assume v0 = 600 m/s, = 60 deg., and k from 0 to 0.08 s-1 with step size of 0.001 s-1 .
Solution
The projectile path with air resistance
x0=0; % m
y0=0; % m
v0=600; % m/s
theta=60; % deg
g=9.81; % m/s^2
k=-0.08;
t_flight=calc_t_flight(g,v0,theta,y0)
range=calc_range(v0,theta,t_flight)
v_impact=calc_v_impact(g,v0,theta,t_flight,y0)
t=linspace(0,t_flight,100);
u=v0*cos(pi*(theta/180));
V=v0*sin(pi*(theta/180));
u(t)=u*exp(-k*t);
v(t)=V*exp(k*t)+(g/k)*(exp(-k*t)-1);
x=(u(t)/k)*(1-exp(-k*t));
y=(-g*t/k)+((k*V+g)/k^2)*(1-exp(-k*t));
plot(x,y)
axis equal
xlabel(sprintf(\'Distance (m) - Range = %5.3f\',range));
ylabel(\'Height (m)\')
The projectile path without air resistance
x0=0; % m
y0=0; % m
v0=600; % m/s
theta=60; % deg
g=9.81; % m/s^2
t_flight=calc_t_flight(g,v0,theta,y0)
range=calc_range(v0,theta,t_flight)
v_impact=calc_v_impact(g,v0,theta,t_flight,y0)
t=linspace(0,t_flight,100);
U=v0*cos(pi*(theta/180));
V=v0*sin(pi*(theta/180));
u(t)=U;
v(t)=(-g*t)+V;
x=u(t)*t;
y= (-1/2)*g*(t^2) +(V*t);
plot(x,y)
axis equal
xlabel(sprintf(\'Distance (m) - Range = %5.3f\',range));
ylabel(\'Height (m)\')


