function y=interp(xn,fn,x)
    n=length(xn)-1;
    y=0;
    for i=(n+1):-1:2
        y=(x-xn(i-1)).*(y+fn(i));
    end
    y=y+fn(1);