# 2.4.16 nlbeginr

## Brief Information

Start a nonlinear fitting session for multiple independent/dependent variables

Minimum Origin Version Required: 8.1 SR0

## Command Line Usage

 nlbeginr irng:=2 func:=gauss nltree:=tt option:=change_data; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input irng

Input

Range

Specify the data to be fitted.
Fitting Function Name func

Input

string

<unassigned>
Specify the fitting function name.
NLFit Tree nltree

Input/Output

TreeNode

nlt
The tree that contains the information of fitting such as parameter values, standard error, etc. For more details, please refer to here.
Fitting Mode mode

Input

int

0
Specify the method to treat the input data for fitting.

Option list:

• auto:Auto
Origin automatically chooses a data mode.
• concat:Concatenate Fit
All input datasets are concatenated and fitted as one curve.
• global:Global Fit
All datasets are fitted globally. This mode should be used when you want to fit one model to multiple datasets with shared parameters.
• cons:Independent Fit - Consolidated Report
All datasets are fitted independently. This mode should be used when you want to fit one model to multiple datasets without shared parameters and create the consolidated reports.
Dialog Theme theme

Input

string

<optional>
Specify a theme. The settings saved in it will be loaded to customize the fitting.
Notation of Parameters pnotation

Input

int

0
Specify the notation of parameters in the output tree.

Option list:

• para:ParaName
Use the parameter names as notation.
• abbr:Abbreviation
Use the abbreviations of the parameters as notation.
• both:Both
Use both names and abbreviations of the parameters as notation.
Parameter Initialization init

Input

int

0
Specify the status of parameter initialization.

Option list:

• auto:Auto
Origin automatically decides whether to enable parameter initialization according to the FDF file of the fitting function.
• enable:Enable
Enable parameter initialization.
• disable:Disable
Disable parameter initialization.
How to Initialize the NLFit Object option

Input

int

0
Specify how to initialize the NLFit Object.

Option list:

• init_all:Init All Parameters
Initialize all parameters and then do the fitting with these parameters.
• change_data:Only Change Data
Keep the former settings and only change dataset, then do the fitting to the new dataset.

## Description

This X-Function is used to start a nonlinear fitting session. Different from the nlbegin X-Function, whose input is XYRange, you can fit multiple independent/dependent variables function by nlbeginr. For example, the input can be XXYYYY, XYYY, XXXXY, etc.

## Examples

This example uses nlbeginr to fit with a build-in GaussianLorentz function, which is a combination of the Gaussian and Lorentz functions, sharing y0 and xc:

$y_1 =y_0+\frac {A_1}{w_1\sqrt{\pi /2}}e^{-2\frac{(x-x_c)^2}{w_1^2}}$
$y_2=y_0+\frac{2A_2}\pi \frac {w_2} {4\left( x-x_c\right) ^2+w_2^2}$
newbook;
string fname$= system.path.program$ +
"Samples\Curve Fitting\Gaussian.dat";
impasc;
// Specify the input range, which follows
// the independent/dependent order in FDF
nlbeginr (1,2,2) GaussianLorentz tt;
// Perform fitting
nlfit;
// Output results
tt.y0=;
tt.xc=;
tt.A1=;
tt.A2=;
tt.w1=;
tt.w2=;
// End the fitting session
nlend;

After fit, you can compare the results in this tutorial.

## Related X-Functions

Keywords:regression, NLFit