# # Plot a phase diagram for this differential equation: # if( !require('phaseR') ){ install.packages('phaseR') } library(phaseR) my_yprime = function(t, y, parameters){ x=y[1] y=y[2] dy = numeric(2) dy[1]=1 dy[2]=x*y*(3-y) list( dy ) } diff_eq_params = c() #postscript("../../WriteUp/Graphics/Chapter2/chap_2_sect_4_prob_17_plot.eps", onefile=FALSE, horizontal=FALSE) flowField(my_yprime, x.lim = c(0, 1), y.lim = c(-6, 6), parameters = diff_eq_params, points = 21, add = FALSE, xlab='t') trajectory(my_yprime, y0= c(0, 5.5), t.end = 1, parameters=diff_eq_params) trajectory(my_yprime, y0 = c(0, 1), t.end = 1, parameters=diff_eq_params) trajectory(my_yprime, y0 = c(0, -1), t.end = 1, parameters=diff_eq_params) #dev.off()