MATLAB Answers

RKF method for second order ODE

7 views (last 30 days)
Sreedhar
Sreedhar on 18 Jun 2014
Answered: Meg Noah on 17 Nov 2020
Hi Does anybody know where program in MATLAB for solution of 2nd order diff equation using RKF method is available. I've seen the RKF method for first order ODE in this site (from book by mathews & Fink). Bur is it available for second order ODE?
TIA

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 18 Jun 2014
You have to create two first-order ODEs from your second order ODE. This is not difficult.
If you have the SymbolicMath Toolbox, it will even do it for you with the odeToVectorField function, then by matlabFunction to create a function from it that the ODE solvers can use.

  3 Comments

Star Strider
Star Strider on 19 Jun 2014
Sreedhar, I looked online and can’t find any reference to the ‘Runge Kutta F method’. It may go by another name, but I can’t find any reference to it anywhere by that name. The Wikipedia article on Runge–Kutta methods doesn’t mention it.
From the ‘> Algorithms’ section under More About for ode45, both ode45 and ode23 are adaptive Runge-Kutta algorithms:
  • ode45 is based on an explicit Runge-Kutta (4,5) formula, the Dormand-Prince pair. It is a one-step solver – in computing y(tn), it needs only the solution at the immediately preceding time point, y(tn-1). In general, ode45 is the best function to apply as a first try for most problems. [3]
  • ode23 is an implementation of an explicit Runge-Kutta (2,3) pair of Bogacki and Shampine. It may be more efficient than ode45 at crude tolerances and in the presence of moderate stiffness. Like ode45, ode23 is a one-step solver. [2]
The MATLAB ode45 and ode23 functions are adaptive time-step solvers. I believe all the others are as well.
That’s the best I can do.
Sreedhar
Sreedhar on 19 Jun 2014
Star strider Many thanks

Sign in to comment.

More Answers (3)

Sreedhar
Sreedhar on 19 Jun 2014
Edited: Sreedhar on 19 Jun 2014
Star Strider Thanks for the answer. I am able to turn the 2nd order ODE to 2 first order ODE's and solve it using ode45. But there is a problem during running which I feel can be resolved by RKF method as it uses adaptive time step. However, there appears to be no function built into MATLAB that uses RKF method. Any clues (textbook reference or MATLAB examples) on how to do this ?
TIA

  0 Comments

Sign in to comment.


Meg Noah
Meg Noah on 17 Nov 2020
Classical Fifth-, Sixth-, Seventh-, and Eighth-Order Runge-Kutta Formulas with Stepsize ControlRunge-Kutta formulas of high order with stepsize control through leading truncation error term
Document ID
19680027281
Document Type
Other - NASA Technical Report (TR)
Authors
Fehlberg, E.(NASA Marshall Space Flight Center Huntsville, AL, United States)
Date Acquired
September 8, 2013
Publication Date
October 1, 1968
Subject Category
MATHEMATICS
Report/Patent Number
NASA-TR-R-287
Distribution Limits
Public
Copyright
Work of the US Gov. Public Use Permitted.

Meg Noah
Meg Noah on 17 Nov 2020
Low-order classical Runge-Kutta formulas with stepsize control and their application to some heat transfer problemsLow order Runge-Kutta formulas with step control for heat transfer problems
Document ID
19690021375
Document Type
Other - NASA Technical Report (TR)
Authors
Fehlberg, E.(NASA Marshall Space Flight Center Huntsville, AL, United States)
Date Acquired
September 2, 2013
Publication Date
July 1, 1969
Subject Category
MATHEMATICS
Report/Patent Number
NASA-TR-R-315
Funding Number(s)
CONTRACT_GRANT: 129-04-03-00-62
Distribution Limits
Public
Copyright
Work of the US Gov. Public Use Permitted.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!