I have a model of a neuron firing. There are many variables in c code, but the one I am interested in is voltage. I want to keep track of how long the neuron fires and once the neuron reaches a certain value (here -20 mV) it will definitely fire. I've attached a picture - I want to keep track of the green parts especially. I'm guessing you use the time fxn but I'm not sure how?
x[i] represents voltage. This is the equation for dx[i]
dx[i]=ab*(-(ina(frt,v[i],n[i],nae[i],nai[i])+inap(frt,v[i],hp[i],nae[i],nai[i])+ik(frt,v[i],n[i],ke[i],ki[i])+ipump[i]+il(v[i])+inmda(inanmda,iknmda,icanmda)+icapump)+iapp); //v