From Eigenvector Research Documentation Wiki
Revision as of 09:31, 10 June 2014 by imported>Scott (→‎Options)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Fits a constant to top/(bottom) of data.


[yf,residual,options] = med2top(y,options)


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));


  • y = trace to be filtered, Mx1 vector.


  • yf = scalar, estimate of filtered data.
  • residual = y - yf.
  • options = input options echoed back, the field initwt may have been modified.


  • ''' 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).

See Also

baseline, baslinew, fastnnls, lsq2top