Get from Ico-github-logo

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
RKN1210 - A 12th/10th order Runge-Kutta-Nyström integrator

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

4.5 | 2 ratings Rate this file 16 Downloads (last 30 days) File Size: 85.9 KB File ID: #25291 Version: 2.0
image thumbnail

RKN1210 - A 12th/10th order Runge-Kutta-Nyström integrator


Rody Oldenhuis (view profile)


11 Sep 2009 (Updated )

Integrator for second-order ODE's with very stringent error tolerances.

| Watch this File

File Information

RKN1210 12th/10th order Runge-Kutta-Nyström integrator
RKN1210() is a 12th/10th order variable-step numerical integrator for second-order ordinary differential equations of the form
      y'' = f(t, y) (1)
with initial conditions

      y(t0) = y0
      y'(t0) = yp0 (2)

This second-order differential equation is integrated with a Runge-Kutta-Nyström method using 17 function evaluations per step. RKN12(10) is a very high-order method, to be used in problems with *extremely* stringent error tolerances.

The RKN-class of integrators is especially suited for problems of type (1). Compared to a classic Runge-Kutta integration scheme, the same accuracy can be obtained with fewer function evaluations. Also, it has been shown in various studies that this particular integration method is overall more efficient than (symplectic) multi-step or extrapolation methods that give the same accuracy.

RKN1210's behavior is very similar MATLAB's ODE-integrator suite; you can set options via ODESET, and input and output values are also practically the same.

Both output functions and event functions are fully supported.

The construction of RKN12(10) is described in
High-Order Embedded Runge-Kutta-Nyström Formulae
IMA Journal of Numerical Analysis (1987) 7, 423-430

Coefficients obtained from
These are also available in any format on request to these authors.

If you find this work useful, please consider a small donation:

MATLAB release MATLAB 7.10 (R2010a)
Other requirements ODE suite, for ODESET() and ODEGET() (standard MATLAB)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
05 Nov 2013 Rody Oldenhuis

Rody Oldenhuis (view profile)

@Sammy Olivaw I uploaded today, so should be tomorrow or so.

Comment only
05 Nov 2013 Sammy Olivaw

@Rody Oldenhuis Thank you! This integrator is really good. Any idea when the update will be up?

05 Nov 2013 Rody Oldenhuis

Rody Oldenhuis (view profile)

@Sammy Olivaw: In principle, yes. There was a bug relating to this issue, but this has been fixed with the pending update.

Comment only
05 Nov 2013 Sammy Olivaw

Does it support integrating backward in time? (ex: tSpan = linspace(0, -10);)

Comment only
18 Mar 2012 Rody Oldenhuis

Rody Oldenhuis (view profile)

@Tarek: thank you for the heads up, it has been corrected and a fixed version will be up as soon as they've approved it!

Comment only
14 Mar 2012 Tarek

Tarek (view profile)

There seems to be a bug when using tspan as a vector to display results at certain time steps. An error message is generated for the index of tout as
Undefined function or variable "index".

Error in ==> rkn1210>finalize at 768
tout = tout (1:index,:);

The codes works fine with specifying tspan as [t0 tf]

14 Jan 2010 1.1

- Interactive demonstration included
- implemented support for event functions
  and output functions
- corrected various bugs, most notably the
  (incorrectly) flipped output when tspan(2) < tspan(1)
- improved error handling

28 Oct 2010 1.2

- Fixed 2 bugs: 1) exitflag = 3 was never assigned or described in the argument [output] 2) intermediate results were erased by event functions and only the event's zero was returned
- Improved performance a bit by pre-assigning the output arrays

19 Feb 2011 1.3

- Removed bug inherited from RKN86; the error estimates there were all wrong. Now RKN1210 integrates at least 50x faster!
- Updated demo; included Earth+J2 example.

18 Mar 2012 1.4

bugfix for missing "index" variable on numel(tspan)>2 as noted by Tarek

11 Jun 2013 1.5

Improvements regarding performance and memory usage.

05 Nov 2013 1.6

- Fixed 2 bugs (thanks everyone!)
- Corrected & improved error handling
- It should be possible to use RKN1210 on R2008a and up
- Improved memory performance a tad
- Small stylistic updates to demo

18 Nov 2013 1.7

- Found & removed some stray debugging code
- Corrected name & doc (ö instead of o)

14 Feb 2014 1.8

- Misc. bugfixes (minor)
- Implemented support for deval(). Note that MATLAB built-in deval() does not support rkn1210; a customized version is in the making.

18 Aug 2015 1.9

fixed divide-by-zero error for isolated cases where f turns all-zero

03 Nov 2016 2.0

- implemented NormControl
- the demo was broken
- error estimation used max() instead of min()
- renamed output.h -> output.stepsize and -> output.estimated_error

See GitHub for way more details (255 char limit here)

05 Nov 2016 2.0

Description update

Contact us