# phasePortrait: Phase Portrait Plot In phaseR: Phase Plane Analysis of One and Two Dimensional Autonomous ODE Systems

## Description

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.

## Usage

 ```1 2 3 4``` ```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"), ...) ```

## Arguments

 `deriv` 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. `ylim` Sets the limits of the dependent variable for which the derivative should be computed and plotted. Should be a vector of length two. `ystep` 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` 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. `points` 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. `frac` 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. `arrow.head` Sets the length of the arrow heads. Passed to arrows. Defaults to 0.075. `col` 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". `xlab` Label for the x-axis of the resulting plot. Defaults to "y". `ylab` Label for the y-axis of the resulting plot. Defaults to "f(y)". `add.grid` Logical. If TRUE, a grid is added to the plot. Defaults to TRUE. `state.names` State names for ode functions that do not use positional states `...` Additional arguments to be passed to either plot or arrows.

## Value

Returns a list with the following components:

 `add.grid` As per input. `arrow.head` As per input. `col` As per input. `deriv` As per input. `dy` A vector containing the value of the derivative at each evaluated point. `frac` As per input. `parameters` As per input. `points` As per input. `xlab` As per input. `y` A vector containing the values of the dependent variable for which the derivative was evaluated. `ylab` As per input. `ylim` As per input. `ystep` As per input.

## Author(s)

Michael J. Grayling

`arrows`, `plot`
 ```1 2 3``` ```# A one dimensional autonomous ODE system, example2. example2.phasePortrait <- phasePortrait(example2, ylim = c(-0.5, 2.5), points = 10, frac = 0.5) ```