%called by run_oscillate
%inhibitory-inhibitory feedback
%with leaky integrate and fire neurons
%linear synapses
function [exit, oute, inhib, outi] = oscillate2 (inpute, inputi, taue, taui,threshe, threshi,steps, we, wi)
exit(1)=0; inhib(1)=0;old_ex=0;old_in=0;oute(1)=0.0; outi(1)=0.0;
for i=2:steps
exit(i)=exp(-1/taue)*old_ex+(1-exp(-1/taue))*(inpute(i)-wi*outi(i-1));
if (exit(i) > threshe)
oute(i)=1.0;
old_ex=0.0;
else
oute(i) = 0.0;
old_ex = exit(i);
end;
inhib(i)=exp(-1/taui)*old_in+(1-exp(-1/taui))*(inputi(i)+we*oute1(i-1));
if (inhib(i) > threshi)
outi(i) = 1.0;
old_in = 0.0;
else
outi(i) = 0.0;
old_in = inhib(i);
end;
end;
t=linspace(1,100);
for (i=1:100)
input(i)=1.0;
end;
%oscillate (input to i1, input to i2, taui1, tau i2, threshi1, threshi2, steps, wi1, wi2
%one exitatory and one inhibitory neuron, both leaky integrate continuous
[e,oe, i, oi]=oscillate2(1.0*input, 1.0*input, 5, 4, 0.8, 0.8, 100, 5.0, 5.0);
figure
plot (t,e+5*oe);
hold;
plot(t, i+5*oi, 'r');