solveODE: Numerical integration of ODEs

solveODER Documentation

Numerical integration of ODEs

Description

Solve a system of ordinary differential equations via a fourth order Runge-Kutta numerical integration scheme.

Usage

solveODE(FUN, initial=NULL, step=0.01, n.sample=1000, n.transient=100, ...)

Arguments

FUN

a function defining the system of ODEs. This function should have as an input X, where X is a vector whose length is equal to the order of the ODEs. It should return a value for each order (state) of the system.

...

additional arguments sent directly to FUN.

initial

a vector of initial values, one element for each state of the system defined by the ODEs. By default, this value is NULL, in which case FUN is called with a X=NULL. Therefore, FUN should be able to handle a NULL value input if you do not specify an initial condition. Default: NULL.

n.sample

the number of desired samples for each state beyond that specified for the transient ala n.transient. Default: 1000.

n.transient

the number of transient points. These points are excluded from the output. Default: 100.

step

a numerical integration time step. Default: 0.1.

Value

a data.frame containing the estimated system response variables.

See Also

par.

Examples

## estimate response of the chaotic Lorenz system 
"lorode" <- function(x, sigma = 10, r = 28, b = 8/3){
    c(sigma * (x[2] - x[1]), x[1] * (r - x[3]) - x[2],  - b * x[3]
       + x[1] * x[2])
}

z <- solveODE(lorode,  initial=c(0.1,0.3,1), n.transient=1500,
    n.sample=2000)
nms <- c("X","Y","Z")

## plot the results 
stackPlot(x=seq(150, by=0.1, length=2000), y=z,
    ylab=nms, main="Lorenz System in Chaos", xlab="Time")

ifultools documentation built on July 14, 2022, 5:07 p.m.