Simple way to set y-intercept at zero using polyfit?
27 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jano
am 11 Nov. 2015
Bearbeitet: Ti Miller-Jackson
am 22 Aug. 2019
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);
0 Kommentare
Akzeptierte Antwort
Star Strider
am 11 Nov. 2015
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 Kommentare
Ti Miller-Jackson
am 22 Aug. 2019
Bearbeitet: Ti Miller-Jackson
am 22 Aug. 2019
Amazing! God bless you @Star Strider!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Point Cloud Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!