Hi All It has been suggested to me that the folks in this list might be able to help me out of my misery.
As part of my learning curve to building a rather detailed model of a small neurone complex I am implementing some existing models in R. For the moment I want to implement the Izhikevich model as described in his 2003 paper. The equations are as follows: v' = 0.04v^2 + 5v + 140 - u - I u' = a(bv - u) if v=30 then v<-c else u<-u+d I don't know how to implement the if condition in my R code. I'm using deSolve. Here is my code so far. library(deSolve); Izhikevich <- function(time, init, parms) { with(as.list(c(init, parms)),{ dv <- (0.04*v^2)+(5*v)+140-u+I; du <- a*(b*v-u); if (v>=30) v<-c else v<-u+d; list( c(dv, du)) })} parms=c( a=0.02, b=0.2, c=-65, d=8,I=10); times=seq(from=1, to=1000, by=1); init=c(v=-65, u=0.2); out<-ode(y=init, times=times, func=Izhikevich, parms=parms) plot(out) Can someone perhaps help me out? Regards Jannetta -- =================================== Web site: http://www.jannetta.com Email: janne...@henning.org =================================== [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.