gradient of the fit with uncertainty and R

5 ビュー (過去 30 日間)
Namira
Namira 2018 年 9 月 14 日
回答済み: Star Strider 2018 年 9 月 14 日
I have a linear fit graph. I used polyfit to compute linear fit.
I would like to calculate the gradient of the fit with error and R. Is there any function in Matlab to calculate R?
I found one solution in Mathworks which is given below
[b, bint] = polyfit(x,y,1); b_err = sqrt(diag((bint.R)\inv(bint.R'))./bint.normr.^2./bint.df);
But I didn't understand the formula.
Any help from anyone?

採用された回答

Star Strider
Star Strider 2018 年 9 月 14 日
See the section in the polyfit (link) documentation on Output Arguments, specifically R (link). It is the ‘Triangular factor from a QR decomposition of the Vandermonde matrix of x’.
Since ‘R’ is a field of ‘bint’ (in the example you posted), there is nothing further you need to do, since ‘R’ is calculated for you. (If I remember correctly, the ‘R’ field is the covariance matrix. It has been a while since I explored polyfit.)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by