How can I perform a linear regression analysis with the equation y=a(x-b)?

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

Answers (2)

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.
Search for "basic fitting" in the on-line documentation. I think that includes all what you need.

Categories

Asked:

on 26 Jul 2012

Community Treasure Hunt

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

Start Hunting!