% compute sigma on u : 
%
% S = values at points U

function su=sigma(S,U,u)

[val,i1] = sort( abs(U-u));


[val,im] = min( U(i1(1:2))-u );
[val,iM] = max( U(i1(1:2))-u );

i1(im);
i1(iM);

val1 = S(i1(im));
val2 = S(i1(iM));

su = val2*( u - U(i1(im)) )/abs( U(i1(im))-U(i1(iM))) + val1*( U(i1(iM))-u )/abs( U(i1(im))-U(i1(iM))) ;

