How can I do a linear fit with forced slope?

조회 수: 10 (최근 30일)
LOre
LOre 2013년 3월 16일
I'm trying to make a best fit of data forcing the slope of a linear fitting...is it possible? How?

채택된 답변

Matt J
Matt J 2013년 3월 16일
편집: Matt J 2013년 3월 16일
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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by