stability.phase.plot: Stability analysis and plots (didactic purpose)

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

For a 2D linear dynamical system, function sta.plot is used to plot state trajectories vs. time. Function sta.plot is used to plot phase-plane and illustrate orbit by arrow. Function root.plot just plots the roots of A. Function root.locus.quad plots is used to plot the locus of the root by sweeping a parameter. It calculates eigenvalues in four quadrants, to be used by functions ReIm.plot and D.plot.

Usage

1
2
3
4
5
6
sta.plot(A, x0, t)
phase.plot(A, x0, t, long = 20)
root.plot(A)
root.locus.quad(det, Tr)
ReIm.plot(x, j, k)
D.plot(x, i)

Arguments

A

matrix

x0

initial condition

t

time sequence

long

determine size of arrows

det

determinant of matrix

Tr

trace of matrix

x

list containing sequences of det and Tr and their discriminant, and eigenvalues (see output from root.locus.quad)

j

quadrant number

i

quadrant number

k

position in array

Details

Given matrix A of 2D linear dynamical system, function sta.plot is used to plot X trajectories vs. time. Function sta.plot is used to plot phase-plane and illustrate orbit by arrow. Determinant, trace, discriminant, and eigenvalues are printed on the plot.

Function root.plot just plots the roots of A. Function root.locus.quad calculates eigenvalues in four quadrants, to be used by plotting functions ReIm.plot and D.plot.

Value

Function root.locus.quad:

det

sequence of det values

Tr

sequence of trace values

D

discriminant for each pair of det and Tr

ReL

real part of eigenvalues for each pair of det and Tr

ImL

imaginary part of eigenvalues for each pair of det and Tr

Other functions do not return values but produce plots.

Note

For didactic purposes.

Author(s)

Miguel F. Acevedo Acevedo@unt.edu

References

Acevedo M.F. 2012. Simulation of Ecological and Environmental Models. CRC Press.

See Also

Matrix operations eigen, solve

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
## Not run: 
t <- seq(0,100,0.1)
# pos det, neg trace, pos D
A <- matrix(c(-0.1,-0.1,-0.2,-0.3),2,byrow=T);x0 <-c(10,5)
sta.plot(A,x0,t)

# pos det, neg trace, pos D
A <- matrix(c(-0.1,-0.1,-0.2,-0.3),2,byrow=T);x0 <-c(10,5)
t <- seq(0,10,0.1)
phase.plot(A,x0,t,long=12)

x <- list()
#pos det, neg trace
det <- seq(0,1,0.5);Tr <- seq(-3,0,0.001) 
x[[1]] <- root.locus.quad(det,Tr)
# pos det, pos trace
det <- seq(0,1,0.5);Tr <- seq(0,3,0.001) 
x[[3]] <- root.locus.quad(det,Tr)
#neg det, neg trace
det <- seq(-1,0,0.5);Tr <- seq(-3,0,0.001) 
x[[2]] <- root.locus.quad(det,Tr)
#neg det, pos trace
det <- seq(-1,0,0.5);Tr <- seq(0,3,0.001) 
x[[4]] <- root.locus.quad(det,Tr)

 mat <- matrix(1:4,2,2,byrow=T)
 nf <- layout(mat, widths=rep(7/2,2), heights=rep(7/2,2), TRUE)
 par(mar=c(4,4,1,.5),xaxs="i",yaxs="i")
for(i in 1:4) D.plot(x[[i]],i)

 mat <- matrix(1:4,2,2,byrow=T)
 nf <- layout(mat, widths=rep(7/2,2), heights=rep(7/2,2), TRUE)
 par(mar=c(4,4,1,.5),xaxs="r",yaxs="r")

  j=1
  ReIm.plot(x[[j]],j,1)
  ReIm.plot(x[[j]],j,2)
  j=3
  ReIm.plot(x[[j]],j,1)
  ReIm.plot(x[[j]],j,2)
  j=2
  ReIm.plot(x[[j]],j,1)
  ReIm.plot(x[[j]],j,2)
  j=4
  ReIm.plot(x[[j]],j,1)
  ReIm.plot(x[[j]],j,2)

## End(Not run)

seem documentation built on April 14, 2017, 9:12 p.m.