Mercurial > hg > aimmat
view aim-mat/tools/@signal/linearfit.m @ 0:74dedb26614d
Initial checkin of AIM-MAT version 1.5 (6.4.2011).
author | tomwalters |
---|---|
date | Fri, 20 May 2011 12:32:31 +0100 |
parents | |
children | 20ada0af3d7d |
line wrap: on
line source
function [m,b]=linearfit(sig) % fit the signal with a streight line and return the slope (m) and the zero % crossing (b) y=getvalues(sig); x=getxvalues(sig); [p,s] = polyfit(x,y,1); m=p(1); b=p(2);