phaseplane {deBif}R Documentation

Phaseplane analysis of a system of ODEs

Description

phaseplane

Usage

phaseplane(model, state, parms, resume = TRUE, ...)

Arguments

model

(function, required)

An R-function that computes the values of the derivatives in the ODE system (the model definition) at time t. The model must be defined as: model <- function(t, state, parms), where t is the current time point in the integration, state is the current value of the variables in the ODE #' system and parms is a vector or list of parameters. The return value of func should be a list, whose first and single element is a vector containing the derivatives of y with respect to time. The derivatives must be specified in the same order as the state variables state. The vector state and parms should both have name attributes for all their elements

state

(numeric vector, required)

The initial (state) values for the ODE system. This vector should have name attributes for all its elements

parms

(numeric vector, required)

The values of the parameters in the ODE system. This vector should have name attributes for all its elements

resume

(boolean, optional)

If TRUE the program will try to load the curves computed during the last session from the global variable '<model>PhaseCurves' and try to restore the numerical and plot settings by importing them from the global variable '<model>PhaseSettings', where the substring '<model>' is the name of the function describing the dynamics, which is passed as first argument to 'bifurcation()'. The program saves the curves computed during a session and the numerical and plot settings of this last session in these global variables '<model>PhaseCurves' and '<model>PhaseSettings'.

...

(optional arguments)

Additional arguments that can be included at the command line to tweak graphical default values used by the application. Valid arguments are:

lwd: Line width (default 2)

cex: Base font size (default 1.2)

tcl.len: Length of axes ticks (default 0.03)

saveplotas: Possible values: "pdf" or "png" (default). Save plot to PDF or PNG file.

Details

phaseplane(model, state, parms, resume = TRUE, ...)

Value

None.

Examples

if(interactive()){
# The initial state of the system has to be specified as a named vector of state values.
state <- c(R=1, N=0.01)

# Parameters has to be specified as a named vector of parameters.
parms <- c(r=1, K=1, a=1, c=1, delta=0.5)

# The model has to be specified as a function that returns
# the derivatives as a list.
model <- function(t, state, parms) {
  with(as.list(c(state,parms)), {

    dR <- r*R*(1 - R/K) - a*R*N
    dN <- c*a*R*N - delta*N

   # The order of the derivatives in the returned list has to be
   # identical to the order of the state variables contained in
   # the argument "state"
    return(list(c(dR, dN)))
  })
}

phaseplane(model, state, parms)
}

[Package deBif version 0.1.8 Index]