function [ iv ] = myinterp1l( X, v )
%MYINTERP1L returns the 1-D interpolated value
%   using 'linear'. X is the vector and v is the
%   value to be interpolated.
%   Minas Spetsakis Nov. 2017

N  = length(X);

vf = floor(v);
vc = ceil(v);

if vf==vc
    vc=vf+1;
end
if vf>=N
    vf=N-1;
    vc=N;
elseif vc<=1
    vf=1;
    vc=2;
end
iv = (X(vf)*(vc-v)+X(vc)*(v-vf))/(vc-vf);

end

