Guest User

Untitled

a guest
Apr 23rd, 2019
72
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. nstep = 100000000; % Number of timesteps to integrate over
  2. Inoise = 0.1;
  3. I0 = 1+Inoise*randn(1,nstep); % Input current in nA
  4. dt = 1; % time step in ms
  5. tau = 10; % membrane time constant in ms
  6. theta = 4; % threshold in mV
  7. v = zeros(1,nstep);
  8. Rin = 2,5; % Input resistance in MOhm
  9. tspike = [];
  10. t = (1:nstep)*dt;
  11. for n=2:nstep
  12. v(n) = v(n-1) + dt*(- v(n-1)/tau + Rin*I0(n)/tau);
  13. if (v(n) > theta)
  14. v(n) = 0;
  15. tspike = [ tspike t(n) ];
  16. end
  17. end
  18. plot(t,v)
RAW Paste Data