Runga-Kutta help needed (Matlab)

  • Context: MATLAB 
  • Thread starter Thread starter Mech-Master
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

The discussion focuses on solving a differential equation for an object falling under gravity with air resistance proportional to the square of its velocity. The exact solution derived is v = sqrt(m*g/c)*tanh(t*sqrt(g*c/m). The user seeks assistance in implementing the 4th order Runge-Kutta method in MATLAB to plot both the exact and numerical solutions for given parameters: g = 9.81 m/s², m = 68.1 kg, and c = 1.5 kg/m, over the interval 0 < t < 6 seconds with a time step of dt = 0.25 seconds. A suggestion is made to use MATLAB's built-in ode45 solver instead of manually coding the Runge-Kutta method.

PREREQUISITES
  • Understanding of differential equations and their applications in physics.
  • Familiarity with MATLAB programming and syntax.
  • Knowledge of numerical methods, specifically the Runge-Kutta method.
  • Basic concepts of air resistance and its mathematical modeling.
NEXT STEPS
  • Explore MATLAB's ode45 function for solving ordinary differential equations.
  • Study the implementation of the 4th order Runge-Kutta method in MATLAB.
  • Learn about plotting functions in MATLAB to visualize solutions.
  • Investigate the effects of varying parameters on the motion of falling objects with air resistance.
USEFUL FOR

Students and professionals in physics and engineering, MATLAB users interested in numerical methods, and anyone looking to model motion under gravity with air resistance.

Mech-Master
Messages
13
Reaction score
0
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

a) Derive the exact solution

done this part, and i got v = sqrt(m*g/c)*tanh(t*sqrt(g*c/m))

b) 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'm having trouble coding the runge kutta method with all the k1, k2, k3 and k4.. I really need help with this.

Thanks
 
Physics news on Phys.org
Matlab already has a built-in Runge-Kutta solver, probabaly ode45. So I think you need not have to worry about those ki's.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 65 ·
3
Replies
65
Views
9K
  • · Replies 4 ·
Replies
4
Views
4K