trajectory {phaseR} | R Documentation |
Phase plane trajectory plotting
Description
Performs numerical integration of the chosen ODE system, for a user specified set of initial conditions. Plots the resulting solution(s) in the phase plane.
Usage
trajectory(
deriv,
y0 = NULL,
n = NULL,
tlim,
tstep = 0.01,
parameters = NULL,
system = "two.dim",
col = "black",
add = TRUE,
state.names = if (system == "two.dim") c("x", "y") else "y",
method = "ode45",
...
)
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 |
y0 |
The initial condition(s). In the case of a one-dimensional system,
this can either be a |
n |
If |
tlim |
Sets the limits of the independent variable for which the
solution should be plotted. Should be a |
tstep |
The step length of the independent variable, used in numerical
integration. Decreasing the absolute magnitude of |
parameters |
Parameters of the ODE system, to be passed to |
system |
Set to either |
col |
The colour(s) to plot the trajectories in. Should be a
|
add |
Logical. If |
state.names |
The state names for |
method |
Passed to |
... |
Additional arguments to be passed to plot. |
Value
Returns a list with the following components (the exact make up is
dependent on the value of system
):
add |
As per input. |
col |
As per input, but with possible editing if a
|
deriv |
As per input. |
n |
As per input. |
method |
As per input. |
parameters |
As per input. |
system |
As per input. |
tlim |
As per input. |
tstep |
As per input. |
t |
A |
x |
In the two-dimensional system case, a |
y |
In the two-dimensional system case, a |
y0 |
As per input, but converted to a |
Author(s)
Michael J Grayling
See Also
Examples
# Plot the flow field, nullclines and several trajectories for the
# one-dimensional autonomous ODE system logistic
logistic_flowField <- flowField(logistic,
xlim = c(0, 5),
ylim = c(-1, 3),
parameters = c(1, 2),
points = 21,
system = "one.dim",
add = FALSE)
logistic_nullclines <- nullclines(logistic,
xlim = c(0, 5),
ylim = c(-1, 3),
parameters = c(1, 2),
system = "one.dim")
logistic_trajectory <- trajectory(logistic,
y0 = c(-0.5, 0.5, 1.5, 2.5),
tlim = c(0, 5),
parameters = c(1, 2),
system = "one.dim")
# Plot the velocity field, nullclines and several trajectories for the
# two-dimensional autonomous ODE system simplePendulum
simplePendulum_flowField <- flowField(simplePendulum,
xlim = c(-7, 7),
ylim = c(-7, 7),
parameters = 5,
points = 19,
add = FALSE)
y0 <- matrix(c(0, 1, 0, 4, -6, 1, 5, 0.5, 0, -3),
5, 2, byrow = TRUE)
simplePendulum_nullclines <- nullclines(simplePendulum,
xlim = c(-7, 7),
ylim = c(-7, 7),
parameters = 5,
points = 500)
simplePendulum_trajectory <- trajectory(simplePendulum,
y0 = y0,
tlim = c(0, 10),
parameters = 5)