calculate the flight path of a projectile with and without air resistance. For s
ID: 1719279 • Letter: C
Question
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 .
Explanation / Answer
flightpath.m:
function [y x] = flightpath(v0, Theta, k)
y = [];
x = [];
g = 10;
u = v0 * cos(Theta * pi / 180.0);
v = v0 * sin(Theta * pi / 180.0);
for t = 1:150
if k == 0
x(length(x) + 1) = u * t;
else
x(length(x) + 1) = (u / k) * (1 - exp(-1 * k * t));
end
if k == 0
y(length(y) + 1) = (-0.5 * g * t^2) + (v * t);
else
y(length(y) + 1) = (-1 * g * t / k) + (((k * v + g) / k^2) * (1 - exp(-1 * k * t)));
end
if y(length(y)) < 0.01
break;
end
end
end
main flightpaths.m:
function main_flightpaths()
y = [];
x = [];
kV = [0 0.005 0.01 0.02 0.04 0.08];
for k = 1:length(kV)
[y x] = flightpath(600, 60, kV(k));
plot(y, x);
figure;
end
end
main range m:
main_flightpaths();
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.