1
$\begingroup$

I need to plot the Integrate the Fire model of neuron. The differential equation is $\frac{dV}{dt} + \frac{V}{\tau} = \frac{I}{C}$. The initial condition is $V(0) = 0$. And there is this condition if whenever $V(t) = \theta$ then $V(t+h) = 0$ where h->0. If you leave the condition then I know how to solve the equation using NDSolve but I don't know how to use that condition and sove the equation. Sample Values $I = 60 × 10^{-9}, R = 10^9,C = 10^{-11}, \theta=5$.

Edit1 - Code for NDSolve using WhenEvent[] NDSolve[{V'[t]+ V[t]/0.01 == 6000,V[0]==0,WhenEvent[V[t]==50,V[t]->0]},V[t],{t,0,10}].

Code for DSolve using WhenEvent-> DSolve[{V'[t]+ V[t]/0.01 == 6000,V[0]==0,WhenEvent[V[t]==50,V[t]->0]},V[t],{t,0,0.1}]. Here you need to specify the range also.

Thanks everyone who helped.

$\endgroup$
4
  • $\begingroup$ Look up WhenEvent[]. $\endgroup$ Feb 16, 2021 at 6:19
  • $\begingroup$ @J.M. Thanks, it worked for the NDSolve. I want to ask can something similar to WhenEvent be done for DSolve also. $\endgroup$
    – A Q
    Feb 16, 2021 at 6:36
  • $\begingroup$ it worked for the NDSolve Why then not post the code you used? This will make it easier to use it as starting point. WhenEvent is supposed to work for DSolve also. There is example here mathematica.stackexchange.com/questions/165405/… $\endgroup$
    – Nasser
    Feb 16, 2021 at 6:59
  • $\begingroup$ @Nasser Actually, you need to specify the range for independent variable in the DSolve when using with WhenEvent. I missed the range, as I had never put range in DSolve till now. Thanks for the help. $\endgroup$
    – A Q
    Feb 16, 2021 at 7:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.