s=polyfit(x,y,2); t=0:1:100; w=s(1)*t.^2+s(2)*t+s(3); S=sum((x-mean(x)).^2); A=sum((w-mean(x)).^2); r2=1-A/S