
clc,clear

%% 数据
x0 = [0 0.5 0.6 0.7 0.8 0.9 1.0];
y0 = [1.00 1.75 1.96 2.19 2.44 2.71 3.00];

xx = 0:0.1:1;

%% 最小二乘拟合
P = polyfit(x0,y0,2);
yy = polyval(P,xx);

%% 画图（plot figure）
hold on;
plot(x0,y0,'ro','Linewidth',2);
plot(xx,yy,'b','Linewidth',1);
text(0.3,2.6,['P_2(x)=',num2str(P(1)),'x^2+',num2str(P(2)),'x+',num2str(P(3))],...
    'Fontsize',15,'Color','blue');