function y = Interpolacion_Cuadratica(xi, x, f)

N =length(x);

for k=1:N-1
    if xi >= x(k) && xi <= x(k+1) break;
    end
end

x0 = x(k);
x1 = x(k+1);
l = k+1;
if (k+2) <= N 
    x2 = x(k+2);
    m = k+2;
else 
    x2 = x1;
    m = l;
end;

b0 = f(k);
b1 = (f(l)- f(k))/(x1 - x0);
b2 = ((f(m) - f(l))/(x2 - x1) - (f(l) - f(k))/(x1 - x0))/(x2 - x0);

y = b0 + b1*(xi - x0) + b2*(xi - x0)*(xi - x1);

end