先画出散点图
>> x = [46 49 51 52 54 56 57 58 59 60 61 62 63 64 66 67 68 71 72];
>> y = [40 50 55 63 72 70 77 73 90 93 96 88 99 110 113 120 127 127 132];
>> plot(x,y,'o')
观察可知,近似为线性关系,所以用一次多项式进行拟合
>> p = polyfit(x,y,1)
p =
3.6995 -131.9833
即拟合结果为:y = 3.6555x-131.9833
绘制拟合曲线
>> hold on
>> plot(x,polyval(p,x),'g')
>> grid on