1、利用MATLAB figure->TOOLS->BASIC FITTING 直接在figure中生成拟合曲线
>> x=0:0.2:10;
>> y=0.25*x+20*sin(x);
>> plot(x,y,'ro')
2、选择拟合系数'plots fits' cubic 5th 8th
3、点击’plot residuals‘显示拟合误差
参考文献:http://www.cnki.com.cn/Article/CJFDTOTAL-NMMS200902005.htm