PLS_Toolbox Documentation: peakfunction< peakfind peakgaussian >

peakfunction

Purpose

Outputs the estimated peaks from parameters in (peakdef)

Synopsis

 

[y,peakdef] = peakfunction(peakdef,ax)

Description

Given the multi-record standard peak structure (peakdef) and the corresponding wavelength/frequency axis (ax), the peak parameters in the field (peakdef.param) are used to generate peaks. This function is called by PEAKFITS and the result is the output (fit), and the peak area estimates in (peakdef) are updated. See PEAKFITS for more information. This function calls PEAKGAUSSIAN, PEAKLORENTZIAN, PEAKPVOIGT1, and PEAKVOIGT2.

INPUTS:

                peakdef   = standard peak structure (see PEAKSTRUCT) output by fitpeaks.

                          ax   = corresponding wavelength/frequency axis. This is also input to the function FITPEAKS. Peak positions are based on this axis.

OUTPUTS:

                            y   = estimated peaks based on the parameters in the input (peakdef).

                peakdef   = the original input (peakdef) with the area field estimated.

Examples

 

  ax            = 0:0.1:100;

  y             = peakgaussian([2 51 8],ax);%Make known peak

%Define first estimate and peak type

  peakdef       = peakstruct;

  peakdef.param = [0.1  43   5];      %coef, position, spread

  peakdef.lb    = [0.0   0   0.0001]; %lower bounds on param

  peakdef.penlb = [1 1 1];

  peakdef.ub    = [10 99.9  40];      %upper bounds on params

  peakdef.penub = [1 1 1];

%Estimate fit and plot

  yint   = peakfunction(peakdef,ax);

  [peakdef,fval,exitflag,out] = fitpeaks(peakdef,y,ax);

  yfit   = peakfunction(peakdef,ax); figure

  plot(ax,yint,'m',ax,y,'b',ax,yfit,'r--')

  legend('Initial','Actual','Fit')


See Also

fitpeaks, peakstruct


< peakfind peakgaussian >