Defining the Fitting Function
Start the nonlinear
curve fitter by selecting Analysis:Nonlinear Curve Fit. If
you are in the basic mode you will see a More button. Click on it
to proceed to the advanced mode. Next select
If you receive the following attention message: "Do you want
to end the fitting session with function...", click Yes. You
are now in the
Define New Function dialog box. To define the function, enter
or select the following for the listed fields:
User-Defined Param. Names: checked
Parameter Names: a,xc,xs,yc,ys
Independent Var.: x,y
Dependent Var.: z
= exp( - (x-xc)^2 / (2*xs^2) );
GaussY = exp( - (y-yc)^2 / (2*ys^2) );
z = a * GaussX * GaussY;
entering all this information, click the Save button to save
your input to a function definition file (*.FDF) in Origin's
FitFunc subfolder. Click on Figure
1 to see how it should all look. Users who do not want
to manually define the fitting function can
download the *.FDF. To get it up and running, be sure
to read the instructions provided on the download page!
from the list of menus in the fitter or click on the
icon to proceed to the Select Dataset dialog box. Assign the datasets
If you are unfamiliar
with this process, follow the steps below:
- Select the z Dep variable.
- Click on data1_c in the Available Datasets list.
- Click the Assign button.
=> Along with assigning data1_c this will automatically assign
data1_a to the x Indep variable and create a plot of data1_c versus
- Select the y Indep variable.
- Click on data1_b in the Available Datasets list.
- Click the Assign button.
Initialize the Parameters
or click on the
icon to proceed to the Fitting Session dialog box. Once there you
will find the five parameters listed in the order in which they
were defined. Scrolling will be necessary to see the parameter called
ys. Parameter a corresponds to the peak amplitude.
Parameters xc and yc represent the center of the peak
along the x and y dimensions respectively. Parameters xs
and ys represent the width (sigma) of the peak along the
x and y dimensions respectively. Initialize
each parameter by entering the appropriate value (as shown in the
list below) in the Value text boxes provided next to each parameter
One Final Step Before Fitting
In order to
illustrate that Origin's curve fitter did indeed fit multiple independent
variables, a comparison between surface plots of the original data
and the fit data is necessary. Since this is the case, the fit data
should be forced to use the same X values as the original data.
To make this happen, select Scripts:After Fit from the fitter's
menus and then the Same X as Fitting Data radio button from
the Fit Curve group. Finally, if you want to save this setting to
the *.FDF file, select Function:Edit and click the Save button
Iterate and Click Done
Return to the
Fitting Session dialog box by selecting Action:Fit again.
Rather than attempting to get the best fit possible, simply click
the 1 Iter. button once or twice. Doing so will provide results
that are accurate enough to illustrate a successful multiple independent
variable fit. Each iteration will take approximately 1 minute to
complete due to the complicated nature of the fitting function.
Once the iterations
are complete, click the Done button to end the fitting session and
exit the fitter. Upon clicking Done the fit data will be appended
to Data1 in a column called B1(Y). The graph will also update to
contain a results label. However, the graph is not important to
the lesson and can therefore be deleted or hidden. To delete or
hide it, simply click on the X in the upper right hand corner of
the graph window, then choose either Delete or Hide.
Convert to Matrix Regular and Plot3D
Before you can
compare the fit data to the original data, all that's left to do
is convert the fit data into a matrix and plot it. Follow the steps
below to do so.
- Change the column designation of B1 from Y to Z.
To do that, activate Data1, right-click on B1(Y) and select Set
As:Z. Alternatively, follow either of the other two methods
outlined in Change
the Z Column Designation to Y. B1(Y) then changes to B1(Z).
C(Y) so that B1(Z) is positioned adjacent to the associated X
and Y data.
To do that, select C(Y) and then Column:Move to Last. Alternatively,
you can delete C(Y) since it is not needed for the purposes of
this lesson. To do so, right-click on C(Y) of the Data1 worksheet
and select Delete.
the XYZ data to a matrix.
Click on B1(Z) and select Edit:Convert to Matrix:Regular.
The data is quickly converted into a matrix.
- Plot the new matrix.
With the newly
created matrix set as the active window, select Plot3D:3D Color
- Rescale one Z axis
The Z scale of the original 3D color map surface plot goes
from 0 to 110, whereas the Z scale of the 3D color map surface
plot for the fit data goes from 0 to 100. To ensure that both
plots are identically displayed, equate the Z axis scales for
To do this, select the 3D color map surface plot of the fit data
and then Format:Axes:Z Axis. Next, select the Scale tab
and enter 110 in the "To" text box. Click OK to apply
the change and close the dialog box. Finally, activate the original
plot and confirm that its Z axis To value is indeed 110. If not,
change it to 110 as well.
both of your graphs you should notice that the 3D color map
surface plot of the fit data is clearly smoother than that
of the of the original data. If you were unable to complete
the example or the graph of your fit data does not appear
to be any different than the graph of the raw data, click
2 to take a look at some typical results. Otherwise, this
completes this Example 1.
are interested in another real world example of multiple independent
variable fitting in Origin, continue to the next