function ret = qif()
figure;
I=-1;
V=0;  
VV=[];  II=[];
V_reset=1;
V_peak=100;
tau = 0.01; tspan = 0:tau:200;
alpha=1-exp(-1*tau);
for t=tspan
    I=I-alpha*(I+1);
    if (t>100) I=3*sin(t/5)+2; end;
    if ((t>18)&(t<20)) I=0.5; end;
    if ((t>25)&(t<60)) if (mod(t,5)<0.01) I=(t-25)/10 + 0.5; end; end;
    if (t>70)&(t<80) I=3; end;
    V = V + tau*(I+V^2);
    if (V>V_peak) V=V_reset; end;    
    VV(end+1)=V;
    II(end+1)=I;
end;
hold on;
plot(tspan,VV,tspan,-20+II);
axis([0 max(tspan) -30 100])
ylabel('V');
xlabel('Time (ms)');
legend('Neuron response','Input current');







