How to make intercept 0 in fitlm?
조회 수: 35 (최근 30일)
이전 댓글 표시
Hello,
i have this code here. I got my result for this code but I want the intercept to be 0. Does anyone know how to do that?
A = [3 ; 6 ; 9 ; 12 ; 15 ; 18 ; 21 ; 24];
b = [13.65249633; 27.43151638; 40.81176096; 54.58291934; 69.15880849; 82.02503856; 95.68163465; 1.10E+02];
mdl = fitlm(A,b,'linear','RobustOpts','off')
Result: Estimate SE tStat pValue
______ ______ ______ ________
(Intercept) -0.14799 0.27475 -0.53862 0.60954
x1 4.579 0.018137 252.47 2.6057e-13
is it possible to make the Estimated intercept 0? I am pretty sure that the estimated x1 will change in value and that's actually what I'm aiming for...
Thanks a lot!
댓글 수: 0
채택된 답변
Rik
2018년 6월 12일
If you just want the value for x1:
A = [3 ; 6 ; 9 ; 12 ; 15 ; 18 ; 21 ; 24];
b = [13.65249633; 27.43151638; 40.81176096; 54.58291934;...
69.15880849; 82.02503856; 95.68163465; 1.10E+02];
x1=A\b;
If you want to force the intercept to 0, you can find the solution in the fitlm doc:
mdl = fitlm(A,b,'linear','Intercept',false)%'RobustOpts','off' is the default
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!