Med2top
Jump to navigation
Jump to search
Purpose
Fits a constant to top/(bottom) of data.
Synopsis
- [yf,residual,options] = med2top(y,options)
Description
MED2TOP is similar to LSQ2TOP with a 0 order polynomial, it can be considered an asymmetric estimate of the mean.
For fitting to the bottom:
>> tsq = residual/res; % (res) is an input >> tsqst = ttestp(1-options.tsqlim,5000,2); % T-test limit from table >> ii = find(tsq>-tsqst); % finds samples below the line
The ii samples are kept for the next estimate of (yf):
>> yf = median(y(ii));
Inputs
- y = trace to be filtered, Mx1 vector.
Outputs
- yf = scalar, estimate of filtered data.
- residual = y - yf.
- options = input options echoed back, the field initwt may have been modified.
Options
- ''' options = a structure array with the following fields.
- display: [ {'off'} | 'on'] Governs screen display to command line.
- trbflag: [ {'top'} | 'bottom' | 'middle'] flag that tells algorithm to fit to the top, bottom, or middle of the data cloud.
- tsqlim: [ 0.99 ] limit that govers whether a data point is outside the fit residual defined by input (res).
- initwt: [ ] empty or Mx1 vector of initial weights (0<=w<=1).