polyfitZero

バージョン 1.3.0.0 (47.1 KB) 作成者: Mark Mikofski
Fit polynomial to data, forcing y-intercept to zero or arb. value and slope to zero or arb. value
ダウンロード: 10.2K
更新 2014/2/19

ライセンスの表示

[update 2014-02-19: fix error in polyfitBM, add root and select-terms tools]
This submission contains four convenience polynomial fitting functions similar to POLYFIT.
1. POLYFITZERO - fit polynomial to data, forcing y-intercept to zero.
2. POLYFITB - force y-intercept to "b".
3. POLYFITB0 - force y-intercept to "b" and slope at (0,b) to zero.
4. POLYFITBM - force y-intercept to "b" and slope at x=0 to "m", e.g.: dy/dx = m.
5. POLYFITBROOT - force intercept and root
6. POLYFITBMROOT - force intercept, slope and root
7. POLYFITBMROOTTERMS - force intercept, slope, root and terms

If you get to POLYFITBMROOTTERMS please just use POLYFITN by John D'Errico:
http://www.mathworks.com/matlabcentral/fileexchange/34765-polyfitn

Forcing the y-intercept to zero is accomplished by noting for polynomial p = [aN, ..., a3, a2, a1, a0],

IE: y = aN*y^N + ... + a3*y^3 + a2*y^2 + a1*y + a0

when x is zero, then y is the constant term, "a0". Therefore a0 = 0, or in the general case when forcing the y-intercept to an arbitrary value, a0 = b.

Forcing the slope at x=0, is accomplished by noticing that the derivative of p

IE: dy/dx = N*aN*y^(N-1) + ... + 3*a3*y^2 + 2*a2*y + a1

evaluated at x = 0 yields "a1". Therefore a1 = 0 for zero slope, or in the general case when forcing the slope to an arbitrary value, a1 = m.

引用

Mark Mikofski (2024). polyfitZero (https://www.mathworks.com/matlabcentral/fileexchange/35401-polyfitzero), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2011b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersLinear and Nonlinear Regression についてさらに検索
謝辞

ヒントを与えたファイル: Transient Diffusion-Reaction Model for CO2 Electrolysis

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.3.0.0

fix error in polyfitBM, add root and select-terms tools

1.2.0.0

add fits that force b to arb value and force slope at (0,b) to arb value.

1.1.0.0

output delta's for error estimation using polyval. add example

1.0.0.0