clear all;
W = - [ 0  2  4  8 ;
        2  0  8 16 ;
        4  8  0 32 ;
        8 16 32  0 ];

s0 = [ 0 0 0 0 ]';

h = 1e-3; g = 2; n = 0;

for x = -0.5:0.01:15.5,
    
    s = s0;
    
    b = - [ 0.5 2 8 32 ]' + x * [ 1 2 4 8 ]';
    
    for k = 1:20000,
        
        o = ( 1 + tanh(g*s) ) / 2;
        s = s + h*(W*o + b);
        
    end;
    
    n = n+1;
    i(n) = [ 1 2 4 8 ]*o;
    
end;

figure; hold on; plot(-0.5:0.01:15.5,i,'k.'); grid on;