Projectile Motion With Air Resistance Vs. Free-Falling with Air Resistance

38 views (last 30 days)
Hello, I am dealing with two cases.
Case 1:Free-Falling Bullet with Air resistance.
Case 2: Projectile Motion with Air Resistance.
Note: Case 1 is just a special case of Case 2 when vx=0.
My problem is that I cannot add my free-falling bullet to the plot. I have already plotted projectile motion for the bullet.
Here I can provide an example of what the graph should look like:
Also, I would like to know how I can calculate the terminal velocity and the time the bullets reach the ground.
Here is my code:
%clear workspace and command window
clear
clc
%Constants for Bullet
m=0.05; %kg (mass)
r=0.01; %m (radius)
C=0.25; %Drag Coefficient of a Sphere
p=1.2; %kg/m^3 (density of air)
A=(pi*(r*2)^2)/4; %m^2 (area of the bullet)
b=(p*C*A)/(2*m); %Constant Needed for Drag Calculations
g=9.81; %m/s^2 (acclereation due to gravity)
%Intitial Conditions
delta_t=.001; %s
h=100; %m (height)
%Case 1: Free-Falling Bullet
x(1)=0; %m
y(1)=100; %m
v=100; %m/s (velocity)
%Case 2: Projectile Bullet With Drag
theta2= 0; %degree
vx(1)=v*cosd(theta2);
vy(1)=v*sind(theta2);
t(1)=0;
i=1; %Sets Counter/Index
%Start Loop For Projectile Motion with Air Resistance
while (min(y)> -.0001)
if vx>0
ax=-(b/m)*v*vx;
else
vx=0;
ax=0;
end
ax=-(b/m)*v*vx;
ay=-g-(b/m)*v*vy;
v=sqrt(vx^2+vy^2);
vx=vx+ax*delta_t;
vy=vy+ay*delta_t;
x(i+1)=x(i)+vx*delta_t+0.5*ax*delta_t^2;
y(i+1)=y(i)+vy*delta_t+0.5*ay*delta_t^2;
t(i+1)=t(i)+delta_t;
i=i+1;
end
plot(x,y,'b'); %Plots Projectile Motion with Drag
xlabel('Horizontal Distance (m)');
ylabel('Vertical Distance (m)');
title ('Projectile Path');
legend('Case 2');

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 18 Apr 2022
You can add the free fall plot using simply, e.g.:
...
xfall=x(1)*ones(size(x));
yfall = linspace(0, h, numel(y));
plot(xfall, yfall, 'gh-'), hold on
plot(x,y,'b'); %Plots Projectile Motion with Drag
xlabel('Horizontal Distance (m)');
ylabel('Vertical Distance (m)');
title ('Projectile Path');
legend('Case 1','Case 2', 'location', 'best');

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!