clear, clc,close all
allaT=(-15:5:0)';
allaP=[1.24 1.95 3.01 4.58]';

for i=2:-1:1
T=allaT(i:end-(2-i));
P=allaP(i:end-(2-i));
Anaiv=[T.^2 T ones(size(T))];
Anewton=[ones(size(T)) T(1)-T (T(1)-T).*(T(2)-T)];
Cnaiv=Anaiv\P;
Cnewton=Anewton\P;
i
pnaiv=Cnaiv(1)*(-8)^2+Cnaiv(2)*-8+Cnaiv(3)

tplot=-15:.2:0;
pplot=Cnaiv(1)*(tplot).^2+Cnaiv(2)*tplot+Cnaiv(3)
plot(tplot,pplot);
hold on
pnewt=Cnewton(1)+Cnewton(2)*(T(1)-(-8))+ Cnewton(3)*(T(1)-(-8))*(T(2)-(-8))
end
plot(allaT,allaP,'*')