if( !require('phaseR') ){ install.packages('phaseR') } library(phaseR) my_yprime = function(t, y, parameters){ y_prime = y^2 * (4-y^2) list( y_prime ) } diff_eq_params = c() #postscript("../../WriteUp/Graphics/Chapter2/chap_2_sect_5_prob_12_plot.eps", onefile=FALSE, horizontal=FALSE) par(mfrow=c(1, 2)) ys = seq( -3, 3, length.out=100 ) fys = my_yprime( 0.0, ys, diff_eq_params ) fys = fys[[1]] plot( ys, fys, type='l', xlab='y', ylab='f(y)' ) abline(h=0, col='black') grid() # Plot the flow field, nullclines and several trajectories: # flowField(my_yprime, x.lim = c(0, 5), y.lim = c(-3, 3), parameters = diff_eq_params, points = 21, system = "one.dim", add = FALSE, xlab='t') nullclines(my_yprime, x.lim = c(0, 5), y.lim = c(-2.5, 2.5), parameters = diff_eq_params, system = "one.dim") abline(h=0, col='red') trajectory(my_yprime, y0 = c(-2.5, -1.5, 1.0, 2.75), t.end = 5, parameters = diff_eq_params, system = "one.dim") par(mfrow=c(1, 1)) #dev.off()