Wlsbaseline: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
No edit summary
imported>Scott
Line 5: Line 5:
===Synopsis===
===Synopsis===


:[bldata,wts,baseline] = wlsbaseline(data,baseline,options)
:[bldata,wts,baseline,vweights] = wlsbaseline(data,baseline,options)
:[bldata,wts,baseline] = wlsbaseline(data,order,options)
:[bldata,wts,baseline,vweights] = wlsbaseline(data,order,options)


===Description===
===Description===

Revision as of 12:49, 27 September 2011

Purpose

Weighted least squares baseline function.

Synopsis

[bldata,wts,baseline,vweights] = wlsbaseline(data,baseline,options)
[bldata,wts,baseline,vweights] = wlsbaseline(data,order,options)

Description

Subtracts a baseline (or other signal) from a spectrum with the constraint that residuals below zero be weighted more heavily, and thus less tolerated, than those above zero. This achieves a robust "non-negative" residual fit when residuals of significant amplitude (e.g. signals on a background) are present.

Inputs are data the spectral data, baseline the reference spectrum/spectra to use for baseline OR an integer value representing the order of polynomial baselining to use and options an optional options structure.

Outputs are the baselined data bldata, the weightings wts indicating the amount of baseline which was removed from each spectrum in data, and baseline the baseline basis. (i.e. bldata = data - wts*baseline)

Polynomial baseline option: If a positive scalar value is given instead of the input baseline, then a polynomial baseline of that order will be used. In this mode, any row of the output wts can be used with the MATLAB polyval function to obtain the baseline removed from the corresponding row of data.

Options

  • plots : [{'none'} | 'debug' | 'intermediate' | 'final'] governs plots
  • weightmode : [ {1} | 2 ] flag indicating which weighting mode to use.
    • Mode 1 = Power method. Negative residuals are weighted up by the power of . All residuals are then raised to the power of (option.power)
    • Mode 2 = T squared method. Negative residuals are weighted up by the extent to which the surpass an estimate of the noise limit and the approximate t-limit defined by (option.tsqlim)
  • trbflag : [ 'bottom' | 'top' ] baseline to top or bottom of data
  • negw : {1} deweighting scale of negative values () (used only for weightmode = 1),
  • power : {2} exponential amplification of residuals (used only for weightmode = 1),
  • tsqlim : [0.99] t-test confidence limit for significant negative residuals which need to be up-weighted. (used only for weightmode = 2).
  • nonneg : ['no'|{'yes'}] flag to force non-negative baseline weighting, most often used when "real" spectra are used for baslineing and they should not be "flipped" by a negative weighting. Using nonneg = 'yes', WLSBASELINE an be used as a partial CLS prediction to estimate the concentration of a species when not all species' pure component spectra are known.
  • delta : [1e-4] change-of-fit convergence criterion. Iterations are stopped when the relative change in fit is less than this value.
  • maxiter : [100] maximum iterations allowed per spectrum,
  • maxtime : [600] maximum time (in seconds) permitted for baselining of all data.

See Also

baseline, baselinew