How can I do a linear fit with forced slope?

13 visualizzazioni (ultimi 30 giorni)
I'm trying to make a best fit of data forcing the slope of a linear fitting...is it possible? How?

Risposta accettata

Matt J
Matt J il 16 Mar 2013
Modificato: Matt J il 16 Mar 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);

Più risposte (0)

Categorie

Scopri di più su Linear and Nonlinear Regression in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by