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?