Problem running linear fit y= m*x

2 次查看(过去 30 天)
hellafella
hellafella 2018-4-22
how do you run a linear fit for y= m*x. I don't want to use polyfit(x,y,1) as this gives y=mx+b.

回答(1 个)

Star Strider
Star Strider 2018-4-22

Use the mldivide,\ (link) function:

m = x(:)\y(:);

类别

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