Baselinew: Difference between revisions
imported>Neal |
imported>Neal |
||
Line 9: | Line 9: | ||
===Description=== | ===Description=== | ||
BASELINEW fits a polynomial "baseline" to the bottom (or top) of a curve (e.g. a spectrum) by recursively calling LSQ2TOP. It | BASELINEW fits a polynomial "baseline" to the bottom (or top) of a curve (e.g. a spectrum) by recursively calling LSQ2TOP. It can be called to use or not use a windowed approach and can be considered a filter or baseline (low frequency) removal algorithm. The window width required depends on the frequency of the low frequency component (baseline). Wide windows and low order polynomials are often used. See LSQ2TOP for more details on the polynomial fit algorithm. | ||
Inputs include the curve(s) to be fit (dependent variable) y, the axis to fit against (the independent variable) x [e.g. y = P(x)], the window width width (an odd integer), the polynomial order order, and an approximate noise level in the curve res. Note that y can be ''M''x''N'' where x is ''1''x''N''. The optional input options is discussed below. | Inputs include the curve(s) to be fit (dependent variable) y, the axis to fit against (the independent variable) x [e.g. y = P(x)], the window width width (an odd integer), the polynomial order order, and an approximate noise level in the curve res. Note that y can be ''M''x''N'' where x is ''1''x''N''. The optional input options is discussed below. |
Revision as of 12:18, 25 September 2008
Purpose
Baseline using windowed (and non-windowed) polynomial filter.
Synopsis
- [y_b,b_b]= baselinew(y,x,width,order,res,options)
Description
BASELINEW fits a polynomial "baseline" to the bottom (or top) of a curve (e.g. a spectrum) by recursively calling LSQ2TOP. It can be called to use or not use a windowed approach and can be considered a filter or baseline (low frequency) removal algorithm. The window width required depends on the frequency of the low frequency component (baseline). Wide windows and low order polynomials are often used. See LSQ2TOP for more details on the polynomial fit algorithm.
Inputs include the curve(s) to be fit (dependent variable) y, the axis to fit against (the independent variable) x [e.g. y = P(x)], the window width width (an odd integer), the polynomial order order, and an approximate noise level in the curve res. Note that y can be MxN where x is 1xN. The optional input options is discussed below.
Output y_b is a MxN matrix of ROW vectors that have had the baselines removed, and output b_b is a matrix of baselines. Therefore, y_b is the high frequency component and b_b is the low frequency component.
Inputs
- y = matrix of ROW vectors to be baselined, MxN [class double].
- x = axis scale, 1xN vector {if empty it is set to 1:N}.
- width = window width specifying the number of points in the filter {if (width) is empty no windowing is used}.
- order = order of polynomial [scalar] to fit {if (order) is empty (options.p) must not be empty; see below}.
- res = approximate fit residual [scalar] {if empty it is set to 5Found of fit of all data to x}.
Examples
If y is a 5 by 100 matrix then
- y_b = baselinew(y,[],25,3,0.01);
gives a 5 by 100 matrix y_b of row vectors that have had the baseline removed using a 25-point cubic polynomial fit of each row of y.
If y is a 2 by 100 matrix then
- y_b = baselinew(y,x,51,3,0.01);
gives a 2 by 100 matrix y_b of row vectors that have had the baseline removed using a 51-point second order polynomial fit of each row of y to x.
Options
- options = structure array with the following fields:
- display : [ 'off' | {'on'} ] governs level of display to command window.
- trbflag : [ 'top' | {'bottom'} ] top or bottom flag, tells algorithm to fit the polynomials, y = P(x), to the top or bottom of the data cloud.
- tsqlim: [ 0.99 ] limit that governs whether a data point is significantly 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: [(relative tolerance) (absolute tolerance) (maximum number of iterations) (maximum time [seconds])].
See Also
baseline, lamsel, lsq2top, mscorr, savgol, stdfir, wlsbaseline