OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis
Skip Navigation Links
 

Fitting With Multiple Independent Variables

Recently we have received a number of inquiries related to fitting with multiple independent variables. Here are just a few:

"I have a set of data with two input variables (X1 and X2) and one output variable (Y). I can graph this data but have not figured out how to curve-fit it?"

"If I have 3 columns A(x1, x2,... x1000), B(x1, x2,....,x1000), and C(x1, x2,....,x1000) and want to fit column C with A and B: C(x1, x2,... x1000)=a*A(x1, x2,....,x1000)+b*B(x1, x2,....,x1000), how can I use the NLSF to find coefficients a and b?"

"Is Origin capable of fitting a 3D linear plane of best fit?"

If you are among the many users who have been asking the same questions about Origin, take a look at the following two examples to find some answers.



Example 1: Fitting Three Dimensional Data

This first example describes the procedure for fitting matrix data to a fitting function containing multiple independent variables. Specifically, random data describing a three dimensional gaussian peak will be fitted in order to find the amplitude of the peak, and the centroids and widths of the peak along the x and y dimensions.

Download the Project

To begin, download 3DFit.EXE from one of the following locations:

Download 3dfit.exe which contains 3DFIT.OPJ:

File Name

Size

Download Location

3dfit.exe

24KB

Massachusetts, USA 

3dfit.exe

24KB

California, USA

3dfit.exe

24KB

London, England

Save the *.EXE to a location of your choosing or accept the default. Next, open Windows Explorer and navigate to where you have saved 3dfit.exe. Double-click on the file to extract the file called 3DFIT.OPJ. Specify the location where you wish the file to be saved or accept the default and click Unzip. Finally, launch Origin and open the project.

Once the project is opened you should find that 3DFIT.OPJ contains a matrix window called RawData. RawData contains the experimental values of the three dimensional gaussian data. The project also contains a 3D Color Map Surface graph of RawData called RawDataPlot. At the end of Example 1 RawDataPlot will compared to a 3D Color Map Surface graph of the fitted data.

Setting Up the Worksheet

During any fit using the nonlinear curve fitter Origin requires the data to be presented in two dimensional form. This requirement is independent of the number of dimensions (variables) that describe your data (3 in our case - x, y and z). Since this is the case, RawData must be converted into a worksheet. Once this is done, the resultant Z column must be changed to a Y column.

Convert to Worksheet => Regular

To start, make sure RawData is active and select Edit:Convert to Worksheet:XYZ Columns. An intermediate dialog box called Convert to Matrix Wksheet will come up asking you to specify how you would like your data to be sorted (X Constant 1st or Y Constant 1st). Click OK to accept the default (X Constant 1st). Your data is converted into an Origin worksheet called Data1.

Change C(Z) to C(Y)

Next, right-click on C(Z) and select Set As:Y. Alternatively, click once on C(Z) and select Column:Set As Y from the Origin menu bar or double-click on the column title to bring up the Worksheet Column Format dialog box and set the Column Designation drop-down list to Y. Click OK to close out of the dialog box if you choose to use the last method mentioned here. The column designation for column C is changed to (Y) and the conversion to two dimensional form is complete.

You are now ready to define the fitting function.

page 1
page 2
page 3

 

Skip Navigation Links.
© OriginLab Corporation. All rights reserved.