Borrar filtros
Borrar filtros

gradient of the fit with uncertainty and R

4 visualizaciones (últimos 30 días)
Namira
Namira el 14 de Sept. de 2018
Respondida: Star Strider el 14 de Sept. de 2018
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?

Respuesta aceptada

Star Strider
Star Strider el 14 de Sept. de 2018
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.)

Más respuestas (0)

Categorías

Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by