For a one dimensional autonomous ODE, it plots the phase portrait i.e. the derivative against the dependent variable. In addition, along the dependent variable axis it plots arrows pointing in the direction of dependent variable change with increasing value of the independent variable. From this stability of equilibrium points (i.e. locations where the horizontal axis is crossed) can be determined.
phasePortrait(deriv, ylim, ystep = 0.01, parameters = NULL,
points = 10, frac = 0.75, arrow.head = 0.075, col = "black",
xlab = "y", ylab = "f(y)", add.grid = TRUE, state.names = c("y"),
...)A function computing the derivative at a point for the ODE system to be analysed. Discussion of the required structure of these functions can be found in the package guide.
Sets the limits of the dependent variable for which the derivative should be computed and plotted. Should be a vector of length two.
Sets the step length of the dependent variable vector for which derivatives are computed and plotted. Decreasing ystep makes the resulting plot more accurate, but comes at a small cost to computation time. Defaults to 0.01.
Parameters of the ODE system, to be passed to deriv. Supplied as a vector; the order of the parameters can be found from the deriv file.
Sets the density at which arrows are plotted along the horizontal axis. points arrows will be plotted. Fine tuning here, by shifting points up and down, allows for the creation of more aesthetically pleasing plots. Defaults to 10.
Sets the fraction of the theoretical maximum length line segments can take without overlapping, that they actually attain. Fine tuning here assists the creation of aesthetically pleasing plots. Defaults to 0.75.
Sets the length of the arrow heads. Passed to arrows. Defaults to 0.075.
Sets the colour of the line in the plot, as well as the arrows. Will be reset accordingly if it is not a vector of length one. Defaults to "black".
Label for the x-axis of the resulting plot. Defaults to "y".
Label for the y-axis of the resulting plot. Defaults to "f(y)".
Logical. If TRUE, a grid is added to the plot. Defaults to TRUE.
State names for ode functions that do not use positional states
Additional arguments to be passed to either plot or arrows.
Returns a list with the following components:
As per input.
As per input.
As per input.
As per input.
A vector containing the value of the derivative at each evaluated point.
As per input.
As per input.
As per input.
As per input.
A vector containing the values of the dependent variable for which the derivative was evaluated.
As per input.
As per input.
As per input.
# NOT RUN {
# A one dimensional autonomous ODE system, example2.
example2.phasePortrait <- phasePortrait(example2, ylim = c(-0.5, 2.5), points = 10,
frac = 0.5)
# }
Run the code above in your browser using DataLab