188.8.131.52.7 Defining a Peak Function
When you use the Peak Analyzer to fit peaks ( OriginPro ), you can select a built-in function for each peak in the Peak Fit Parameters dialog, or designate a user-defined function with the Fitting Function Organizer or Fitting Function Builder. Defining a peak function is very similar to designing a user-defined fitting function, but it must obey the following rules:
- The function should be in the PFW category and the Peak Function check box should be selected.
- The function should at least have four parameters that correspond to different peak characteristics. The parameter attributes are set with the Peak Attributes column, which is in the Parameter Settings dialog. The first parameter should be named y0 and should be assigned the attribute Offset/Baseline. The other parameters may be assigned arbitrary names, but should be assigned attributes of X Center, X Width and Amplitude/Area.
The following example demonstrates how to define a peak function named AsymmetricGauss and use it in Peak Analyzer.
The peak function to be defined is expressed as below:
- double B,sig;
- sig = x<xc ? sig1:sig2;
- y = y0 + B * exp(-0.5 *((x-xc)/sig)^2);
where x is independent variable, y is dependent variable, y0, sig1, sig2, xc are parameters corresponding to attributes offset, peak area, left peak width, right peak width, peak center, respectively.
There are general 7 steps in defining a peak function for fitting in Peak Analyzer:
1. Hit F8 key or go to menu Tools: Fitting Function Builder to open.
2. Click Next to go to the Name and Type page, select PFW category from Select or create a Category drop-down list, input AsymmetricGauss as Function Name. Select Origin C from Function Type panel.
- If you want to define a function to fit your baseline ( OriginPro ) in Peak Analyzer, you must put the user-defined function into the Baseline category.
- To make peak function available for Quick Peaks Gadget or Multiple Peak Fit tool, you should select Peak Function category instead.
3. Click Next to go to the Variables and Parameters page, input variables and parameters as shown below and check Peak Function check box:
4. Click Next to go to the Origin C Fitting Function page. Click on each cell in Peak Attribute column to set peak attributes for each parameter. Enter initial parameter values. Input meaning for each parameter. Enter function equations in Function Body edit box and do a quick check at x = 1120 to make sure the expression is written correctly as shown below:
5. Click Next button to go to the Parameter Initialization Code page, and enter the following codes into the Initialization Code edit box as shown below:
6. Click Next button to go to the Bounds and General Linear Constraints page. Double click in cells in < or <= column(s) to toggle operators and then enter lower and upper bounds. Setting bounds for each parameter will confine the fitted results in sensible range as show below:
7. Click Finish button and the peak function is created and placed in PFW category.
After this, you can perform peak fitting with this function in Peak Analyzer by choosing it from the Peak Type drop-down list in the Peak Fit Parameters dialog.
If you want to make existing fitting functions available for peak fitting, choose Tools: Fitting Function Organizer. Right click the function and choose Move to or Share to and select PFW as the drop-down list option in appeared dialog.