med2top
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).
stopcrit: [1e-4 1e-4 1000 360]
stopping criteria, iteration is continued until one of the stopping criterion
is met [(rel tol) (abs tol) (max # iterations) (max time [seconds])].
initwt: [ ] empty or Mx1 vector of
initial weights (0<=w<=1).
See Also
baseline, baselinew, fastnnls, lsq2top