Main Content

coeffvalues

cfitsfit 对象的系数值

说明

示例

coeffvals= coeffvalues(fun) 以 1×n 向量 coeffvals 形式返回 cfitsfit 对象 fun 的系数或参数值,其中 n = numcoeffs(fun)

示例

全部折叠

加载 census.mat 文件中的数据,并为二次多项式曲线构造一个 fittype

load census
f = fittype('poly2');

获取 fittype 对象 f 的系数名称和公式。

coefficientNames = coeffnames(f)
coefficientNames = 3x1 cell
    {'p1'}
    {'p2'}
    {'p3'}

formula(f)
ans = 
'p1*x^2 + p2*x + p3'

对数据进行曲线拟合,并检索系数值。

c = fit(cdate,pop,f);
coefficientValues = coeffvalues(c)
coefficientValues = 1×3
104 ×

    0.0000   -0.0024    2.1130

输入参数

全部折叠

要计算其系数的对象,指定为 cfitsfit 对象。

输出参数

全部折叠

cfitsfit 对象 fun 的系数值,以标量或向量形式返回。

版本历史记录

在 R2006a 之前推出