% Tund 11, ülesanne 2
% andmed
x=[9,9.5,10,11];
y=[2.197,2.251,2.302,2.397];
plot(x,y,'o')
hold on
% Phi(x)=c3*x^3+c2*x^2+c1*x+c0
% c3, ... , c0 =?
syms xx;
summa=0;
for i=1:length(x)
      L=1;
    for j=1:length(x)
      if i~=j
         L=L*(xx-x(j))/(x(i)-x(j));
      end
    end
    summa=summa+y(i)*L;
end
lagrangepolynoom=simplify(summa)

syms z(xx);
z(xx)=lagrangepolynoom;
% ln9.2
vpa(z(9.2))
% täpne
log(9.2)