[R-sig-dyn-mod] how to pulse input
Jinsong Zhao
jszhao at yeah.net
Mon Apr 21 00:44:46 CEST 2014
Hi there,
I want to affect a model with pulse input. Now I do this something like
this:
C_Only <- function(time, state, parameters) {
with(as.list(c(state,parameters)), {
# rate of change
Dc <- Kd * Enzc
### pulse input at time = 25 ###
if (time >= 25 & time < 26) Uc <- 10 + Dc else Uc <- DOC + Dc
###
print(c(time, Uc))
EPc <- Ke * Uc
ELc <- Kl * Enzc
Re <- EPc * (1 - SUE) / SUE
Rm <- Km * Biomc
Rg <- (Uc - EPc - Re - Rm) * (1 - SUE)
dEnzc <- EPc - ELc
dBiomc <- Uc - EPc - Re - Rm - Rg
# return the rate of change
list(c(dEnzc, dBiomc))
})
}
Is it the correct way to set pulse input? How I can set the pulse input
time within function argument?
Any help will be really appreciated.
Best wishes,
Jinsong
More information about the R-sig-dynamic-models
mailing list