Sample Code of Projectile Motion. Unknown constant that's used.
Show older comments
Disclamer: I am using the following code to help guide me through a projectile motion problem.
function projectile(theta,v0,dt,tf)
t = 0:dt:tf;
vx = v0*cos(theta);
vy = v0*sin(theta);
vx(1) = vx;
vy(1) = vy;
v = sqrt((vx^2)+(vy^2));
v(1) = v;
x(1) = 0;
y(1) = 0;
B2divm = 0.00004;
g = 9.81;
for i = 1:length(t)-1
v = sqrt((vx(i)^2)+(vy(i)^2));
x(i+1) = x(i) + vx(i)*dt;
vx(i+1) = vx(i) - (B2divm*v*vx(i))*dt;
y(i+1) = y(i) + vy(i)*dt;
vy(i+1) = vy(i) - g*dt - (B2divm*v*vy(i))*dt;
end
plot(x,y,'r')
end
I follow and reasonably understand the code, except for the use of the constant 'B2divm=0.0004'.
I strongly suspect that 'B2divm' above has something to do with Drag and air density, but I just don't know.
Anybody know what it means? How it's derived?
Thanks!!
Accepted Answer
More Answers (0)
Categories
Find more on Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!