Skip to content

Instantly share code, notes, and snippets.

@dhfromkorea
Created August 1, 2015 20:38
Show Gist options
  • Save dhfromkorea/eebe13c22fe0a4a4f19d to your computer and use it in GitHub Desktop.
Save dhfromkorea/eebe13c22fe0a4a4f19d to your computer and use it in GitHub Desktop.
plotting a phase portrait of non-linear autonomous ODE's using phaseR
if (!require(phaseR)){
install.packages('phaseR')
require(phaseR)
}
# a system of two non-linear autonomous ODE's
ode = function (t, y, parameters) {
x <- y[1]
y <- y[2]
dy <- numeric(2)
dy[1] <- x-x*y
dy[2] <- y+2*x*y
list(dy)
}
ode.flowField <- flowField(ode, x.lim = c(-5, 5), y.lim = c(-5, 5), points = 21, add = FALSE)
ode.nullclines <- nullclines(ode, x.lim = c(-5, 5), y.lim = c(-5, 5), points = 200)
# p14.trajectory <- trajectory(p14, t.end = 10, n=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment