phasePlaneAnalysis: Phase plane analysis

View source: R/phasePlaneAnalysis.R

phasePlaneAnalysisR Documentation

Phase plane analysis

Description

Allows the user to perform a basic phase plane analysis and produce a simple plot without the need to use the other functions directly. Specifically, a range of options are provided and the user inputs a value to the console to decide what is added to the plot.

Usage

phasePlaneAnalysis(
  deriv,
  xlim,
  ylim,
  tend = 100,
  parameters = NULL,
  system = "two.dim",
  add = FALSE,
  state.names = if (system == "two.dim") c("x", "y") else "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 vignette, or in the help file for the function ode.

xlim

In the case of a two-dimensional system, this sets the limits of the first dependent variable in any subsequent plot. In the case of a one-dimensional system, this sets the limits of the independent variable. Should be a numeric vector of length two.

ylim

In the case of a two-dimensional system this sets the limits of the second dependent variable in any subsequent plot. In the case of a one-dimensional system, this sets the limits of the dependent variable. Should be a numeric vector of length two.

tend

The value of the independent variable to end any subsequent numerical integrations at.

parameters

Parameters of the ODE system, to be passed to deriv. Supplied as a numeric vector; the order of the parameters can be found from the deriv file. Defaults to NULL.

system

Set to either "one.dim" or "two.dim" to indicate the type of system being analysed. Defaults to "two.dim".

add

Logical. If TRUE, the chosen features are added to an existing plot. If FALSE, a new plot is created. Defaults to FALSE.

state.names

The state names for ode functions that do not use positional states.

Details

The user designates the derivative file and other arguments as per the above. Then the following ten options are available for execution:

  • 1. Flow field: Plots the flow field of the system. See flowField.

  • 2. Nullclines: Plots the nullclines of the system. See nullclines.

  • 3. Find fixed point (click on plot): Searches for an equilibrium point of the system, taking the starting point of the search as where the user clicks on the plot. See findEquilibrium.

  • 4. Start forward trajectory (click on plot): Plots a trajectory, i.e., a solution, forward in time with the starting point taken as where the user clicks on the plot. See trajectory.

  • 5. Start backward trajectory (click on plot): Plots a trajectory, i.e., a solution, backward in time with the starting point taken as where the user clicks on the plot. See trajectory.

  • 6. Extend Current trajectory (a trajectory must already be plotted): Extends already plotted trajectories further on in time. See trajectory.

  • 7. Local stable/unstable manifolds of a saddle (two-dimensional systems only) (click on plot): Plots the stable and unstable manifolds of a saddle point. The user clicks on the plot and an equilibrium point is identified see (3) above, if this point is a saddle then the manifolds are plotted. See drawManifolds.

  • 8. Grid of trajectories: Plots a set of trajectories, with the starting points defined on an equally spaced grid over the designated plotting range for the dependent variable(s). See trajectory.

  • 9. Exit: Exits the current call to phasePlaneAnalysis().

  • 10. Save plot as PDF: Saves the produced plot as "phasePlaneAnalysis.pdf" in the current working directory.

Author(s)

Michael J Grayling, Stephen P Ellner, John M Guckenheimer


phaseR documentation built on Sept. 2, 2022, 5:07 p.m.