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:
OUTPUTS:
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
< peakfind | peakgaussian > |