4.2.2.17 Fitting Complex Function

Summary

When fitting with a complex function, we can easily separate the complex function to two functions: one corresponding to its real part and the other corresponding to its imaginary part. With these two functions, we can define the complex fitting function with two dependent variables by Fitting Function Organizer and can access it in NLFit dialog. We will illustrate how to fit with complex function below. More details about fitting with multiple dependent or independent variable please refer to Fitting with Multiple Independent Variables.

Minimum Origin Version Required: Origin 8.0 SR6

What you will learn

This tutorial will show you how to:

  • Create a user-defined complex fitting function with two dependent variables and one independent variable
  • Fit with such function in NLFit

Steps

  1. Select whole form below (including header line) and right click to choose Copy to put the data in clipboard.
    Omega Y1 Y2
    0 3 0
    0.01 2.88462 -0.28846
    0.02 2.58621 -0.51724
    0.03 2.20588 -0.66176
    0.04 1.82927 -0.73171
    0.05 1.5 -0.75
    0.06 1.22951 -0.7377
    0.07 1.01351 -0.70946
    0.08 0.8427 -0.67416
    0.09 0.70755 -0.63679
    0.1 0.6 -0.6
    0.11 0.5137 -0.56507
  2. Select Import/ Import Wizard to open Import Wizard dialog. Then choose Clipboard in Data Source group and click Finish to import the data.
    ComplexfittingClipboard2.png
  3. Select Tools: Fitting Function Organizer from menu (or press F9) to bring up the Fitting Function Organizer and define a new fitting function named ComplexFitting in NewCategory (create the category if not exist) as follow:
    Function Name:

    ComplexFitting

    Function Type:

    User-Defined

    Independent Variables:

    omega

    Dependent Variables:

    y1,y2

    Parameter Names:

    A,tau

    Function Form:

    Origin C

    Function:

    complex cc = A/(1+1i*omega*tau);
    y1 = cc.m_re;
    y2 = cc.m_im;

    Note: To use the imaginary unit "i" for creating complex numbers, you need to write it as "1i" in Origin C, as in the above Function row. And complex is a class that implements a complex number data type. It contains both a Real and an Imaginary component.

    For more details about creating user-defined fitting function, please refer to User Defined Fitting Function using Origin C.

  4. Highlight all the columns and select Analysis: Fitting: Non-linear Curve Fit from menu to bring up the NLFit dialog. Select the function ComplexFitting from NewCategory on the Settings: Function Selection page. Set the input datasets in the Data Selection page as follow:
    ComplexFitSelectData.png
  5. Select Parameters Tab and set the initial values as follows:
    ComplexFitParameter.png
  6. Click Fit to generate the fitting report sheet. You can see the results from the report worksheet as below:
    ComplexfittingPara.png
    ComplexFitResultsStas.png
    From the Statistics table, we can see that the fitting is fairly successful.