% conductance-based synaptic model
clear; clf;

g0=1;
R=1000;
tau_m=10;
t_syn=10;
v_reversal=10;
delta_t=0.1;

I(1)=0;
v(1)=0;
g(1)=g0;

for t_step=2:1000
    g(t_step)= (1-delta_t/t_syn)*g(t_step-1);
    I(t_step)= g(t_step)*(v(t_step-1)-v_reversal);
    v(t_step) = (1-delta_t/tau_m)*v(t_step-1) - I(t_step)/R;
end

plot(v)