matlab多变量曲线拟合?具体条件在问题补充里!一共有8组数据,abcd是自变量,F是因变量,需要利用这些数据用matlab编程拟合成一条曲线,得出一个含有abcd变量的F=f(abcd)函数,由于初学不知道该怎

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 12:56:17
matlab多变量曲线拟合?具体条件在问题补充里!一共有8组数据,abcd是自变量,F是因变量,需要利用这些数据用matlab编程拟合成一条曲线,得出一个含有abcd变量的F=f(abcd)函数,由于初学不知道该怎

matlab多变量曲线拟合?具体条件在问题补充里!一共有8组数据,abcd是自变量,F是因变量,需要利用这些数据用matlab编程拟合成一条曲线,得出一个含有abcd变量的F=f(abcd)函数,由于初学不知道该怎
matlab多变量曲线拟合?具体条件在问题补充里!
一共有8组数据,abcd是自变量,F是因变量,需要利用这些数据用matlab编程拟合成一条曲线,得出一个含有abcd变量的F=f(abcd)函数,由于初学不知道该怎么入手,希望高手及热心的朋友帮帮忙,希望能尽量详细点,
F a b c d
4 30 98 330 16
4 50 80 300 14
6 70 85 300 14
9 90 82 300 14
9 130 61.9 300 14
12 150 75 300 14
16 182 90 300 14
20 200 115 330 16

matlab多变量曲线拟合?具体条件在问题补充里!一共有8组数据,abcd是自变量,F是因变量,需要利用这些数据用matlab编程拟合成一条曲线,得出一个含有abcd变量的F=f(abcd)函数,由于初学不知道该怎
你需要用到多元线性回归知识,可在百度文库中查阅相关文档.
b = regress(y,X)
[b,bint] = regress(y,X)
[b,bint,r] = regress(y,X)
[b,bint,r,rint] = regress(y,X)
[b,bint,r,rint,stats] = regress(y,X)
[...] = regress(y,X,alpha)
Description
b = regress(y,X) returns
a p-by-1 vector b of coefficient
estimates for a multilinear regression of the responses in y on
the predictors in X. X is an n-by-p matrix
of p predictors at each of n observations. y is
an n-by-1 vector of observed responses.
regress treats NaNs
in X or y as missing values,
and ignores them.
If the columns of X are linearly dependent, regress obtains
a basic solution by setting the maximum number of elements of b to
zero.
[b,bint] = regress(y,X) returns
a p-by-2 matrix bint of 95%
confidence intervals for the coefficient estimates. The first column
of bint contains lower confidence bounds for each
of the p coefficient estimates; the second column
contains upper confidence bounds.
If the columns of X are linearly dependent, regress returns
zeros in elements of bint corresponding to the
zero elements of b.
[b,bint,r] = regress(y,X) returns
an n-by-1 vector r of residuals.
[b,bint,r,rint] = regress(y,X) returns
an n-by-2 matrix rint of intervals
that can be used to diagnose outliers. If the interval rint(i,:) for
observation i does not contain zero, the corresponding
residual is larger than expected in 95% of new observations, suggesting
an outlier.
In a linear model, observed values of y are
random variables, and so are their residuals. Residuals have normal
distributions with zero mean but with different variances at different
values of the predictors. To put residuals on a comparable scale,
they are "Studentized," that is, they are divided by
an estimate of their standard deviation that is independent of their
value. Studentized residuals have t distributions
with known degrees of freedom. The intervals returned in rint are
shifts of the 95% confidence intervals of these t distributions,
centered at the residuals.
[b,bint,r,rint,stats] = regress(y,X) returns
a 1-by-4 vector stats that contains, in order,
the R2 statistic,
the F statistic and its p value,
and an estimate of the error variance.

编程:
X=[4 30 98 330 16
4 50 80 300 14
6 70 85 300 14
9 90 82 300 14
9 130 61.9 300 14
12 150 75 300 14
16 182 90 300 14
20 200 115 330 16];
[b,bint,r,rint,stats]=regress(X(:,1),[ones(8,1),X(:,2:5)])

输出结果为:
b =
0
0.082993089926365
0.103081750366204
-0.057468684629848
0.652640885769813
bint =
0 0
0.071017315753211 0.094968864099519
0.023739569890405 0.182423930842002
-0.218829948407466 0.103892579147770
-3.061483019586739 4.366764791126366
r =
-0.069392478146224
-0.292561537437667
-0.467832087795991
1.181551364775316
-0.066229049918604
-0.076461778243175
-0.278466911379915
0.069392478146227
rint =
-1.029865909670362 0.891080953377914
-1.975633610489564 1.390510535614231
-2.027297628007013 1.091633452415032
0.988179668324118 1.374923061226515
-1.098793108250143 0.966335008412934
-1.892263187406570 1.739339630920220
-1.811179826587819 1.254246003827988
-0.891080953377921 1.029865909670376
stats =
1.0e+002 *
0.009921829135368 1.692331993021668 0.000001142763391 0.004494824716318

方程为:
F= 0.082993089926365*a+ 0.103081750366204*b -0.057468684629848*c+
0.652640885769813*d

stats第一参数为0.99说明拟合效果非常好,第三个参数远少于0.05说明F检验通过,关系式显著成立.