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

回答 (2 件)

Honglei Chen
Honglei Chen 2012 年 7 月 26 日

0 投票

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
per isakson 2012 年 7 月 26 日
編集済み: per isakson 2012 年 7 月 26 日

0 投票

Search for "basic fitting" in the on-line documentation. I think that includes all what you need.

カテゴリ

ヘルプ センター および File ExchangeLinear and Nonlinear Regression についてさらに検索

質問済み:

2012 年 7 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by