Simple way to set y-intercept at zero using polyfit?

I can not seem to find a simple way to to set my y-intercept at 0 using the polyfit function. Here is my syntax so far, please let me know what I should add/change.
fd=polyfit(xfd,fttd,1) %xfd and fttd are both column vectors of length 4 such that xfd=[2;4;6;8] (fttd is a time vector with more complicated numbers)% xfd1=linspace(0,8); fttd1=polyval(fd,xfd1); figure(3) plot(xfd1,fttd1);

 채택된 답변

Star Strider
Star Strider 2015년 11월 11일
To the best of my knowledge, polyfit does not allow that. Forcing a zero intercept to a linear regression is straightforward, however:
slope = xfd(:)\fttd(:);

댓글 수: 4

Jano
Jano 2015년 11월 11일
thank you <3
My pleasure!
Jano
Jano 2015년 11월 11일
thank you <3
Ti Miller-Jackson
Ti Miller-Jackson 2019년 8월 22일
편집: Ti Miller-Jackson 2019년 8월 22일
Amazing! God bless you @Star Strider!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

2015년 11월 11일

편집:

2019년 8월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by