How can I do a linear fit with forced slope?

11 Ansichten (letzte 30 Tage)
LOre
LOre am 16 Mär. 2013
I'm trying to make a best fit of data forcing the slope of a linear fitting...is it possible? How?

Akzeptierte Antwort

Matt J
Matt J am 16 Mär. 2013
Bearbeitet: Matt J am 16 Mär. 2013
If your data are column vectors x and y and your model is
y=m*x+b
then the solution for b would simply be
b_fit = mean(y-m*x);

Weitere Antworten (0)

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by