Help with fitting linear equation

I need help with my HW pls, I have a data set and I have to fit a linear equation on a given data to identify the intercept and the slope

回答(4 个)

help robustfit
the final exampel contains also a standard linear regression using "regress".
And a third option:
B = [ones(size(x(:))) x(:)]\y(:);
slope = B(2)
intercept = B(1)
Image Analyst
Image Analyst 2015-11-13
See my attached polyfit demo that I have posted countless times.

类别

帮助中心File 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