function nterp =  interpol(y,xi)
% linear interpolation in array y (1-D)
xir = round(xi);
off = abs(xi - xir);
if off <.01
    nterp = y(xir,:);
    return
end

x1 = floor(xi);
x2 = x1+1;
xd = (x2 - x1);
y1 = y(x1);
yd = (y(x2)- y1);
nterp = y1 + ((xi - x1)*(yd ./ xd));
end
