function [ iv ] = myinterp1l2( 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 Mar. 2021

N  = length(X);

vc = ceil(v);
vc = vc.*(vc<=N) + N*(vc>N);
vc = vc.*(vc>1) + 2*(vc<=1);
vf = vc-1;

iv = (X(vf).*(vc-v)+X(vc).*(v-vf))./(vc-vf);

end

