15.3.4.4.3 The Name and Type Page

The Name and Type page allows you to set the category, function name, function model and function type. The left panel of this page offers hints and examples for each of the function types.

Dialog Box Controls

Select a Category Select an existing category in which to put the newly-created function. This control is unavailable if you chose Edit a User-defined function on the previous (Goal) page.

To make user-defined peak and baseline functions available in Peak Analyzer, you must select the PFW category for peak fitting functions or the Baseline category for baseline fitting functions. If you decide later to reclassify a user-defined function, note that you can move or share fitting functions using the Fitting Function Organizer (Tools: Fitting Function Organizer). Locate a function to share or move, then right-click and choose an option from the shortcut menu.

New Click this button Ffb new category.png to bring up a dialog with which you can create a new category. This control is unavailable when you choose Edit a User-defined function on the Goal page.
Function Name Input a name for the function. This control is unavailable when you choose Edit a User-defined function on the Goal page.
File Name(.FDF) For each newly created function, Origin will create an associated .FDF in the \FitFunc folder of your Origin User Files Folder. This read-only edit box just shows the name of the fitting function file.
Description Add descriptions for the function.
Function Model Specify the function model. Options include:
  • Explicit
    The function formula can be defined explicitly as y=f(x).
  • Implicit
    The function formula cannot be defined explicitly, which is expressed as f(x,y)=estimate, where estimate is 0 and expressed as f in Origin.
Function Type Specify how to use the function in the Function Body page. Options include:
  • LabTalk Expression
    Select this option for simple fitting functions that have only one dependent variable. The function body is limited to one expression, and you need to provide only the right hand side of the equation. This option provides faster performance than Origin C. The following example demonstrates this kind of function body.
    a + b * exp( -x^c / d );
  • Python Function (Scalar)
    Scalar functions receive one value for each independent variable during a call and return one value for each dependent variable. This option is slower than vector-based fitting and therefore is best used with smaller datasets. For reasons of speed, we recommend using vectorial Python fitting functions. The following example demonstrates this kind of function body. Note that you must prefix "py." to the function name when creating the function body. The following example demonstrates this kind of function body.
    y = py.pyline(x, a, b);
  • Python Function (Vector)
    Vectorial functions receive an array (in the form of a list) of independent values for each independent variable during a call and return an array (in the form of a list) for each dependent variable. For this reason, it is much faster than using scalar functions. This option uses no LabTalk processing. The following example demonstrates this kind of function body.
    y=pyGaussVectorEq(x,y0,xc,A,w);
  • LabTalk Equations
    Select this option if you need multiple lines or you have more than one dependent variable. This option does not support control structures such as loops or if-else statements. You can however use the ternary operator. This option provides faster performance than Origin C. The following example demonstrates this kind of function body.
    temp = 10;
    y1 = A + exp( (x1 - xc) / temp^2 );
    y2 = A + temp / (x2 - xc)^2;
  • Origin C
    This option is slower than Equations. Select this option if your fitting function requires loops or control structures that cannot be replaced by the ternary operator. Note that you need to follow strict C syntax: parameters are case sensitive, and division by an integer is different than division by a double. The following example demonstrates this kind of function body.
    if ( x < -PI )
    y = y0 + exp( -x-a*PI );
    else if ( x > PI )
    y = y0 + exp( x-a*PI );
    else
    y = cos(x);
  • LabTalk Script
    This option is much slower than Equations or Origin C. Select this option if you need control structures or you are not familiar with C language. The following example demonstrates this kind of function body.
    range rr = %C;
    int b = %(rr[P1]$);
    y = b + a*x;
  • External DLL-based Function
    Select this option to define a fitting function using an external DLL. Using an external DLL can improve fitting time significantly. For more details about this type, please refer to Using External DLLs.


Include Integration During Fitting

Select this option to define an integrand and include it in the fitting function. This is only available when Function Type is LabTalk Expression, LabTalk Equations or LabTalk Script. The function model can be Explicit or Implicit.