# 4.2.2.34 Nonlinear fitting using Orthogonal Distance Regression

## Summary

When performing non-linear curve fitting to experimental data, one may encounter the need to account for errors in both independent variables and dependent variables. In Origin, you can utilize the Orthogonal Distance Regression (ODR) to fit your data with implicit or explicit functions. This tutorial will demonstrate how to perform non-linear curve fitting on data with both X errors and Y errors using ODR with a built in function.

Minimum Origin Version Required: Origin 9.1

## What you will learn

This tutorial will show you how to use Orthogonal Distance Regression to fit nonlinear data with both X and Y errors.

## Example and Steps

1. Open a new workbook. Select Help: Open Folder: Sample Folder... to open the "Samples" folder. In this folder, open the Curve Fitting subfolder and find the file ODR fitting.dat. Drag-and-drop this file into the empty worksheet to import it.
2. Highlight column XError (long name) and right click to select Set As: X Error to set it as X error column.
3. Highlight column YError (long name) and right click to select Set As: Y Error to set it as Y error column.
4. Highlight all four columns and go to Plot:Basic 2D:Scatter to make a scatter plot with both X and Y error bars.
5. Go to Analysis:Fitting:Nonlinear Curve Fit:Open dialog... to open NLFit dialog.
6. On Function Selection page, select Category as Polynomial, Function as Poly4 and Iteration Algorithm as Orthogonal Distance Regression (Pro). 7. Since X error and Y error columns have been specified in step 3, 4 so that when Orthogonal Distance Regression is selected as iteration algorithm these two columns will be automatically assigned as corresponding weight for X and Y data respectively. You can go to Data Selection page and expand x and y nodes under Input Data to see. 8. Click Fit button and choose No radio box in the appeared Reminder Message dialog, and click OK to close it, the fitting results are as shown below: You can refer to this page for the details of the algorithm of ODR as well as Levenberg Marquardt (L-M) algorithm. Another example of using Orthogonal Distance Regression for Implicit Functions can be found here.