How can I perform a linear regression analysis with the equation y=a(x-b)?
Afficher commentaires plus anciens
Hi
I am new to MATLAB.
I don't have access to the statistics toolbox but I would like to perform a linear regression on my data but I need the x intercept (and standard error of the intercept) so need to use the linear equation in the form y=a(x-b) rather than y=ax+b. If I could get the r squared value for the fit too that would be great.
Thanks for your help Gavin
Réponses (2)
Honglei Chen
le 26 Juil 2012
0 votes
This is essentially the same as fitting y=ax+b since it can be written as y=ax+b=a(x-(-b/a)). So all you need to do is to fit y=ax+b and then do the conversion. You can use polyfit to do the fit of y=ax+b.
per isakson
le 26 Juil 2012
Modifié(e) : per isakson
le 26 Juil 2012
0 votes
Search for "basic fitting" in the on-line documentation. I think that includes all what you need.
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!