matlab多项式拟合
发布网友
发布时间:2022-04-20 20:07
我来回答
共3个回答
热心网友
时间:2023-09-21 17:48
在命令窗口下输入
x=[。。。]
y=[。。。]
cftool
在Curve Fitting Tool界面中,单击Data。。。,选择x Data和y Data,选择Create data set,选择Close
在Curve Fitting Tool界面中,单击Fitting。。。,选择New fit,选择Type of fit,选择Polynomial,选择9th degree polynomial,打勾Center and scale X data项和Immediate apply项,选择Apply
在Results框内,就会出现如下信息
Linear model Poly9:
f(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 +
p5*x^5 + p6*x^4 + p7*x^3 + p8*x^2 + p9*x + p10
where x is normalized by mean 2007 and std 4.183
Coefficients (with 95% confidence bounds):
p1 = 1250 (-2623, 5123)
p2 = -1317 (-3803, 1169)
p3 = -7686 (-2.787e+004, 1.25e+004)
p4 = 7016 (-4784, 1.882e+004)
p5 = 1.706e+004 (-1.775e+004, 5.186e+004)
p6 = -1.244e+004 (-2.995e+004, 5083)
p7 = -1.69e+004 (-3.952e+004, 5721)
p8 = 8533 (-214.7, 1.728e+004)
p9 = 9654 (5118, 1.419e+004)
p10 = 1.902e+004 (1.797e+004, 2.007e+004)
Goodness of fit:
SSE: 1.213e+006
R-square: 0.9921
Adjusted R-square: 0.9742
热心网友
时间:2023-09-21 17:49
x=2000:1:2013;
y=[17118 17230 17492 17460 17495 17573 17770 19834 23393 23741 24090 24438 24786 25135]; %输入原始数据
cftool; %调用曲线拟合工具箱
在x、y处选择已经输入的x向量和y向量,在拟合方式选择多项式(polynomial),并选择几次多项式拟合(degree),这里是用5次多项式拟合的结果:
在左边的results窗口中会显示多项式具体的系数,以及拟合程度。
热心网友
时间:2023-09-21 17:49
x=2000:1:2013;
y=[17118 17230 17492 17460 17495 17573 17770 19834 23393 23741 24090 24438 24786 25135];
n=2;%多项式次数
[p,s,mu]=polyfit(x,y,n) %具体参数意思看MATLAB帮助