//// Synaptic conductance model to simulate an EPSP clear; clf; //// Setting some constants and initial values tau_syn=1; c_m=1; g_0=1; E_syn=10; delta_t=0.01; I(1)=0; v(1)=0; g(1)=1; //// Numerical integration using Euler scheme for t_step=2:10/delta_t g(t_step)= (1-delta_t/tau_syn) * g(t_step-1); I_syn(t_step)= g(t_step) * (v(t_step-1)-E_syn); v(t_step) = (1-delta_t/c_m*g_0) * v(t_step-1) ... - delta_t/c_m * I_syn(t_step); end //// Plotting results t=(1:10/delta_t)*delta_t; plot(t,v); plot(t,g*5,'r--'); plot(t,I_syn/5,'k:')