MATLAB Runga-Kutta help needed (Matlab)

  • Thread starter Thread starter Mech-Master
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion focuses on the dynamics of an object falling under the influence of gravity and air resistance proportional to the square of its velocity. The differential equation governing the object's velocity is established as m*dv/dt = mg - cv^2, leading to the exact solution v = sqrt(m*g/c)*tanh(t*sqrt(g*c/m). The user seeks assistance in implementing the 4th order Runge-Kutta method to numerically solve for velocity over a specified time interval, expressing difficulties in coding the method's steps (k1, k2, k3, k4). A suggestion is made to utilize MATLAB's built-in ode45 function, which simplifies the process by handling the Runge-Kutta calculations automatically, alleviating the need to manually code the intermediate steps.
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
Views
1K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
1
Views
1K
Replies
4
Views
2K
Replies
1
Views
6K
Replies
15
Views
3K
Replies
4
Views
3K
Back
Top