Matlab functions for replicate time series regression