function M = nMatRec( n )
% by Paolo Bientinesi

if n == 1, 
    M = 1;
    
elseif mod(n,2)==0,
    zero = zeros(n-1,1);
    M = [    n      zero'     -n    ; ...
          zero   nMatRec(n-1)  zero ; ...      
            -n      zero'      n    ];

else
    M = nMatRec(n-1);
    
                      M(1,(n+1)/2) = n;
    M((n+1)/2,1) = n;                   M((n+1)/2,end) = n;
                     M(end,(n+1)/2) = n;
end
end