%
% Solve shunting ode with center-surround interactions
% Input: c 1D array of input node activations
% Output: Y 1D array of output node activations
% Shunting equations is solved at equilibrium
%
function Y = CenterSurround1D(c)
A = 1; % decay rate
B = 90;% upper bound of shunting eq
D = 60;% lower bound of shunting eq
W = [4 .5 ]*log(2);
%Distant dependent center surround interactions are encoded
%as difference of gaussians
% DOG = C*exp(alfa/d^2) - E*exp(betta/d^2)
alfa = -1; %
betta = -1/64;
SIZE = length(c);
RFS=SIZE/2; %receptive field depth in shunting eq computation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for iNode = 1:length(c)
[CX, EX] = DDO();
Y(iNode) = (CX*B - EX*D)./(A+CX+EX);
end
%distance-dependent opponency
function [CX,EX] = DDO()
CX = 0;
EX = 0;
for i = iNode-RFS:iNode+RFS
if i <= 0 ||i > SIZE
continue;
end
dd = (i-iNode)^2;
expalfa = exp(alfa*dd);
expbetta = exp(betta*dd);
CX = CX + W(1)*c(i)*expalfa; %center - excite
EX = EX + W(2)*c(i)*expbetta; %surround inhibits
end
end
end