Alignpeaks

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Calibrates wavelength scale using standard peaks.

Synopsis

s = alignpeaks(x0,x1,ax,options)
y = alignpeaks(s,y1)

Description

ALIGNPEAKS calibrates a wavelength scale using standard peak positions. Ideally, the axis scale (x0) would apply to a single instrument at time t = 0 and t > 0 or for two different instruments. However, (x1) at t > 0 doesn't typically match (x0) at t = 0 even though the numbers in the scales are identical. The result is that a plot of (x0,y0) and (x0,y1) appear shifted from one another.

The inputs to ALIGNPEAKS are (x0) a 1xK vector containing the axis locations of K peaks on the standard instrument at t = 0 (e.g., the true wavelengths), (x1) a 1xK vector containing the axis locations of the corresponding peaks on the field / test instrument at t > 0 (e.g., the peak positions on the field instrument), and ax a 1xN vector containing the axis scale where N > K. ALIGNPEAKS finds a polynomial fit between (x0) and (x1) and outputs the result in the structure array (s). The output (y) is a fit of (x1).

Options

Optional input (options) is a structure array with the following fields:

  • name: 'options', name indicating that this is an options structure,
  • plots: [ 'none' | {'final'} ] governs level of plotting, and
  • order: [ {2} ] integer giving the polynomial order.

Executing options = alignpeaks('options'); gives an empty options structure.

Example

A measurements at t = 0 gives a spectrum (y0) with axis (ax), and measurements at t > 0 of the same sample yields a spectrum (y1) with the same axis (ax) but with peaks shifted. Therefore

plot(ax,y0,'b',ax,y1,'r')

shows a shift in the peaks. The peak positions at t = 0 are listed in (x0) and the peak positions at t > 0 are listed in (x1). The polynomial fit is given by

s = alignpeaks(x0,x1,ax);

and the transformed spectrum is obtained with

y10 = alignpeaks(s,y1);

so that

plot(ax,y0,'b',ax,y1,'r')

shows less of a peak shift. See alignpeaksdemo.

See Also

alignmat, alignspectra, registerspec, stdgen