Description Usage Arguments Value See Also Examples
Solve a system of ordinary differential equations via a fourth order Runge-Kutta numerical integration scheme.
1 |
FUN |
a function defining the sytem 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 |
initial |
a vector of initial values, one element for each state of the system defined by the ODEs.
By default, this value is |
n.sample |
the number of desired samples for each state beyond that specified for the
transient ala |
n.transient |
the numeber of transient points. These points are excluded from the output. Default: 100. |
step |
a numerical integration time step. Default: 0.1. |
a data.frame
containing the estimated system response variables.
par
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.