% Mingbo Cai
% 10/23/08
%
% to compute the critical NeGe for instability onset given other
% parameters acooding to equation B.4 and the definition following equation
% 5.2
%
% This function will call function findhete
% Input are given spatial constant lambdas and the interation strength of
% inhibitory neurons NiGi. n is the number of hills to be expected, tau is
% the same decay constant for both excitatory and inhibitory neurons'
% conductance.
% Notice that bJi which is beta * Ji is negative.
% Example:
% NeGe = in2e(11.5, 43, 0.333, 1, 3) will generate the critical NeGe for
% figure 4

function NeGe = in2e(lambda_e, lambda_i, NiGi, n, tau)
Ei = -80;
Ee = 0;
EL = -65;
Vc = 5.5;
bJi = NiGi * tau * (Ei - EL - Vc) * 35.4 / 1000 % unit transform
bJe = findhete(lambda_e, lambda_i, bJi, n)
NeGe =  bJe / 35.4 / tau / (Ee - EL - Vc) * 1000;
