Baseline: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Neal |
||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Line 13: | Line 12: | ||
This function baselines spectra with a polynomial baseline function. The baseline function is fit to user-specified regions (regions free of peaks), which is then subtracted from the original spectra. | This function baselines spectra with a polynomial baseline function. The baseline function is fit to user-specified regions (regions free of peaks), which is then subtracted from the original spectra. | ||
Inputs are spec class "double" or "dataset" containing the spectra, freqs the wavenumber or frequency axis vector, and range which specifies the baselining regions (see below). If freqs is omitted and spec is a dataset, the axissscale from the dataset will be used; otherwise a linear vector will be used. | Inputs are (spec) class "double" or "dataset" containing the spectra, (freqs) the wavenumber or frequency axis vector, and (range) which specifies the baselining regions (see below). If (freqs) is omitted and (spec) is a dataset, the axissscale from the dataset will be used; otherwise a linear vector will be used. | ||
range can be either an | (range) can be either an ''M'' by 2 matrix which specifies ''M'' baselining regions or a logical vector equal in length to the spectra with a 1 (one) at each point to be used as baseline and 0 (zero) elsewhere. | ||
The output newspec contains the baselined spectra and b the polynomial coefficients. | The output (newspec) contains the baselined spectra and (b) the polynomial coefficients. | ||
If b is input instead of range with baselined spectra newspec then the output spec is a matrix original "unbaselined" spectra. | If (b) is input instead of (range) with baselined spectra (newspec) then the output (spec) is a matrix of original "unbaselined" spectra. | ||
===Options=== | ===Options=== |
Revision as of 12:10, 25 September 2008
Purpose
Subtracts a baseline offset from spectra.
Synopsis
- [newspec,b] = baseline(spec,freqs,range,options);
- spec = baseline(newspec,freqs,b,options);
Description
This function baselines spectra with a polynomial baseline function. The baseline function is fit to user-specified regions (regions free of peaks), which is then subtracted from the original spectra.
Inputs are (spec) class "double" or "dataset" containing the spectra, (freqs) the wavenumber or frequency axis vector, and (range) which specifies the baselining regions (see below). If (freqs) is omitted and (spec) is a dataset, the axissscale from the dataset will be used; otherwise a linear vector will be used.
(range) can be either an M by 2 matrix which specifies M baselining regions or a logical vector equal in length to the spectra with a 1 (one) at each point to be used as baseline and 0 (zero) elsewhere.
The output (newspec) contains the baselined spectra and (b) the polynomial coefficients.
If (b) is input instead of (range) with baselined spectra (newspec) then the output (spec) is a matrix of original "unbaselined" spectra.
Options
options = a structure array with the following fields:
- plots: [ {'none'} | 'final' ] governs plotting of results, and
- order: positive integer for polynomial order {default = 1}.
The default options can be retreived using: options = baseline('options');.
See Also
baselinew, deresolv, lamsel, lsq2top, normaliz, polyinterp, savgol, savgolcv, specedit, stdgen, wlsbaseline