필터 지우기
필터 지우기

gradient of the fit with uncertainty and R

조회 수: 4 (최근 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 CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by