[R-sig-dyn-mod] Skinny square waves (John Harrold)

Stephen Paul Ellner spe2 at cornell.edu
Wed Mar 8 16:03:59 CET 2017


John, 

the efficient deSolve solvers can't deal with such rapid on-off changes (even if you make the changes continuous). And even with start and stop times in the output times, the solvers may well leap over the 30 minute periods when the forcing is 'on' and give you interpolated output values for output times during the 'on' periods. 

The way I've always dealt with such situations is to solve the 'on' and 'off' periods separately. 

for(j in 1:whatever) {
	solve from stop[j] to start[j+1] with forcing=0
	solve from start[j+1] to stop[j+1] with forcing = value 
}
storing the results along the way in one big data frame or matrix. 

Steve

Stephen P. Ellner 
Department of Ecology & Evolutionary Biology, E339 Corson Hall
Cornell University, Ithaca NY 14853-2701



More information about the R-sig-dynamic-models mailing list