matlab polyfit拟合出来的函数怎样分析其精确程度?用误差分析怎么算??结果具体怎样分析??谢谢

2024-12-30 09:02:58
推荐回答(2个)
回答1:

Year=[1625 1830 1930 1960 1974 1987 1999];
Population=[5 10 20 30 40 50 60];
Year1=1625:2020;
Year2=2000:2020;
[P2 S2]=polyfit(Year,Population,3);
Population1=polyval(P2,Year1);
Population2=polyval(P2,Year2);
plot(Year,Population,'*',Year2,Population2,'X',Year1,Population1);
这里的S2是误差的大小~

回答2:

拟合值与实际值做差,使得sum(abs(shiji-nihe))取得最小即可
一般阶次高精度也较高,但表达式往往比较复杂,在简单与精度方面折中考虑