# Curve and Surface Fitting

Curve fitting is one of the most powerful and most widely used analysis tools in Origin. Curve fitting examines the relationship between one or more predictors (independent variables) and a response variable (dependent variable), with the goal of defining a "best fit" model of the relationship.

Origin provides tools for linear, polynomial, and nonlinear curve fitting along with validation and goodness-of-fit tests. You can summarize and present your results with customized fitting reports. There are many time-saving options such as a copy-and-paste-operation feature which allows you to "paste" a just-completed fitting operation to another curve or data column. Curve fitting operations can also be part of an Analysis Template™, allowing you to perform batch fitting operations on any number of data files or data columns.

## Linear, Polynomial, and Multiple Regression

Linear and Polynomial regressions in Origin make use of weighted least-square method to fit a linear model function or a polynomial model function to data, respectively.

### Linear Fit

 Masking outliers during linear fit Linear fit with fixed intercept or slope Ellipse Plot for graphical examination of linearity Linear Fit with X Error PRO Apparent Fit

### Polynomial Fit

The Polynomial Fit tool in Origin can fit data with polynomial up to 9th order. Fixed intercept and apparent fit are also supported.

### Multiple Linear Regression

Multiple Linear Regression fits multiple independent variables

A unique feature of Origin's Multiple Linear Regression is Partial Leverage Plots, useful in studying the relationship between the independent variable and a given dependent variable:

Graph displaying raw data, linear fit line, and 95% confidence and prediction bands.

Result of an Apparent Linear Fit on data plotted with logarithmic Y axis scale.

Linear Fit with X Error minimizes the sum of square of error on both X and Y directions, which is more practical for real experimental data where errors exist in both X and Y directions.

Polynomial Fitting can be performed with polynomials up to 9th order. Fixing intercept is supported. Apparent fit can also be performed with nonlinear axis scales.

Multiple Regression with partial leverage plots to examine relationship between independent and dependent variables.

## Nonlinear Curve Fitting

Origin's NLFit tool is powerful, flexible and easy to use. The NLFit tool includes more than 170 built-in fitting functions, selected from a wide range of categories and disciplines. Each built-in function includes automatic parameter initialization code that adjusts initial parameter values to your dataset(s), prior to fitting.

Can't find a suitable fitting function in the built-in function library? No problem. You can easily define a custom fitting function using our Fitting Function Builder.

Not only does Origin handle the most demanding curve fitting tasks with ease, it also has a built in C compiler that allows me to customize complex functions - a feature that has been crucial to my research. Origin is an indispensable tool to my grad students, whose PhD work hinges on being able to code our functions in C. To top it off, Originlab has a knowledgeable and responsive technical support staff, second to none. I wholeheartedly recommend Origin.

Mark Kuzyk, Ph.D. - Regents Professor of Physics and Astronomy, Washington State University

View more testimonials!

With just a few clicks, you can perform curve fitting and obtain "best-fit" parameter values. Origin provides over 170 built-in fitting functions

The Fitting Function Builder wizard can help you define a custom fitting function.

### Fitting Multiple Datasets

Do you have multiple datasets that you would like to fit simultaneously? With Origin, you can fit each dataset separately and output results in separate reports or in a consolidated report. Alternately, you can perform global fitting with shared parameters; or perform a concatenated fit which combines replicate data into a single dataset prior to fitting.

 Global fit with shared parameters Concatenate fit for replicate data Independent fit for multiple curves

The image on the left displays a global fit where the width parameter has been shared. The image on the right shows replicate data fitted by internally combining all data into one concatenated dataset.

### Implicit Fitting PRO

Do you need to fit an implicit function to your data? Origin's NLFit tool supports implicit fitting using the Orthogonal Distance Regression (ODR) algorithm, including fitting with X and/or Y error data.

Implicit Fitting uses the Orthogonal Distance Regression algorithm to find optimal values for the fit parameters. Errors or weights are supported for both X and Y data.

### Fitting Control

Need to fine-tune your curve-fitting analysis? With Origin, you have full control over the curve-fitting process:

 Fix parameter values Least square fit with Y weight (e.g. error as weight) Use parameter bounds and/or linear constraints

In addition to the basic fitting options, you also have access to extended options for more advanced fitting. Note that some options are available only in OriginPro:

 Fit with integrals Fit with replicas Multivariate regression Fit with convolution Orthogonal Distance Regression with X and/or Y weight PRO

## Surface Fitting PRO

Origin's NLFit tool provides an intuitive interface for fitting your XYZ or matrix data to a surface model. With this tool, you could locate one or multiple peaks in your surface data and fit them with the built-in or user-defined surface fitting functions.

Surface fitting can be performed on data from XYZ columns or from a matrix. Over 20 built-in surface fitting functions are provided. You can also add your own function.

## Compare Models and Datasets PRO

Having trouble deciding which function works best with your data? Want to evaluate which data better fits a particular model? OriginPro's fit comparison tools make it easy for you to compare models or compare data:

• Fit and rank all functions in a category PRO
• Compare two fitting models to one dataset PRO
• Comparing two datasets with one fitting model PRO

The Rank Models tool lets you fit multiple functions to a dataset, and then reports the best fitting model. Results are ranked by Akaike and Bayesian Information Criterion scores.

## Time-Saving Fitting Options

Take advantage of Origin's many time-saving features including an intuitive set of fitting Gadgets, shortcut menu commands for commonly used fitting operations, and several modes for handling of repetitive tasks:

 Quick Fit Gadget Sigmoidal Fit and Gadget Exponential Fit Copy & paste fitting operations Batch Processing with Analysis Templates

The Quick Fit gadget lets you perform regression on a subset of the data selected graphically using a Region of Interest (ROI) control. This image shows linear regression performed on two separate segments of the data. The fit results have been added as labels to the graph for the two segments.