Iterative procedure of L-M algorithm need to calculate the partial derivatives of fitting functions to go forward to the best fit. So when you define your user-defined function, specifying partial derivatives can reduce the time it takes to perform a set of iterations.
If you wish to specify partial derivatives, note that you must specify the derivatives of the function of the dependent variable in terms of the fit parameters.
If you did not specify partial derivatives, Origin will solve the partial derivatives of fitting functions with numeric methods.
In the Fitting Function Organizer
If you have chosen to define the function using Origin C, the variables for the partial derivatives will be pre-defined in Code Builder. You just need to enter the expression for them.
For example, if the function is:
The partial derivatives for each parameter should be:
Then if you define an Origin C fitting function, the variables dy_P1, dy_P2, and dy_P3 will be available, and can define the function with partial derivatives by:
y = p1 + p2*x + exp(p3*x);
dy_p1 = 1;
dy_p2 = x;
dy_p3 = x * exp(p3*x);
If you want to define your function using LabTalk, select Y-Script in Fitting Function Organizer or Labtalk Script in Fitting Function Builder, Use d_VarName to represent the derivative variables.
However, Origin C is easier to use because it enables user to compile and evaluate the functions before they really use it. Now we don't recommend specifying partial derivative using Labtalk.
For the same example as in tutorial of above section
The function and the partial derivatives can be defined by Labtalk as below