How Does Air Resistance Affect Falling Objects in MATLAB Simulations?

Click For Summary
SUMMARY

The discussion focuses on simulating the effect of air resistance on falling objects using MATLAB. The differential equation governing the motion is m*dv/dt = mg - cv^2, with parameters g = 9.81 m/s², m = 68.1 kg, and c = 1.5 kg/m. The exact solution is derived using the formula vs = sqrt(m*g/c)*tanh(t*sqrt(g*c/m), while the numerical solution is computed using the 4th order Runge-Kutta method with a time step of dt = 0.25 seconds over the interval 0 < t < 6. The provided MATLAB code contains an error where the vector v is not initialized properly, leading to confusion in the implementation.

PREREQUISITES
  • Understanding of differential equations, specifically m*dv/dt = mg - cv^2
  • Familiarity with MATLAB programming and syntax
  • Knowledge of numerical methods, particularly the 4th order Runge-Kutta method
  • Basic physics concepts related to motion and forces, including air resistance
NEXT STEPS
  • Review MATLAB's plotting functions to visualize simulation results effectively
  • Learn about MATLAB's built-in functions for solving differential equations
  • Explore advanced numerical methods for improving simulation accuracy
  • Investigate the impact of varying parameters (mass, drag coefficient) on the simulation outcomes
USEFUL FOR

This discussion is beneficial for physics students, MATLAB programmers, and anyone interested in simulating physical phenomena involving air resistance and numerical methods for solving differential equations.

Mech-Master
Messages
13
Reaction score
0

Homework Statement



An object of mass m falls from rest at a point near the Earth's surface. If the air resistance is proportional to the velocity v^2, the differential equation for the velocity as a function of time is given by m*dv/dt = mg - cv^2

For the given paraments g = 9.81 m/s^2. m = 68.1 kg and c = 1.5 kg/m. plot the exact solution and the numerical solution v(t) obtained from the 4th order predictor-corrector runge kutta methods using an interval of dt = 0.25 seconds in the domain of 0<t<6

(I need help with the code of runga kutta, I am horrible at matlab


Homework Equations



m*dv/dt = mg - cv^2


The Attempt at a Solution





clear
clc
g = 9.81
m = 68.1
c = 1.5
tmax = 6
dt = 0.25
t = [0:dt:tmax]
v(1) =1;

%Exact Solution
vs = sqrt(m*g/c)*tanh(t*sqrt(g*c/m));
plot(t,vs,'s'), hold on

%Runge-Kutta
for i = 1:length(t)-1
f= g - c*v(i).^2/m;
k1= f(v(i));
k2= f(t(i)+(dt/2), v(i) + (dt/2)*k1);
k3 =f(t(i)+(dt/2), v(i) + (dt/2)*k2);
k4 =f(t(i)+ dt, + v(i) + dt*k3);
v(i+1) = v(i) + (dt/6)*(k1+2*k2+2*k3+k4);
end
 
Physics news on Phys.org
If you look in the first row of the for loop, the vector v is not defined so the code doesn't make sense.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K