ndCurveMaster

Curve Fitting Tutorial: From Polynomial to Nonlinear Model

The primary use of ndCurveMaster is curve fitting. In many simple cases, this can be done in Excel, but for more complex relationships curve fitting in Excel may become difficult, limited, or inefficient.

This tutorial shows how to fit a curve to data step by step, starting with a simple polynomial model and then improving it by searching for a more accurate nonlinear equation.

Let us consider the following example:

Input data for the curve fitting example

First, we load the file CurveFitting.txt into the program. You can download this file here.

Next, in the program window, we set the parameters as shown below:

Initial settings for curve fitting in ndCurveMaster

In the Search options section, we select:
Polynomial, rational and power functions up to 3.

After confirming, the initial linear model containing one predictor will appear:

Initial curve fitting model with one predictor

Next, we extend the model by adding additional nonlinear predictors. The easiest way to do this is by clicking the Load button. More details on loading and saving functions can be found here.

Load function set option in ndCurveMaster

We load the function set poly3.mf5:

Loading the poly3 function set

We confirm the selection by clicking Yes:

Confirmation dialog for loading new predictors

The model is then extended with additional predictors:

Extended polynomial model for curve fitting

As can be seen, the polynomial:

y = a0 + a1·x + a2·x² + a3·x³

does not provide a good fit to the data.

Therefore, we will try to improve the model by searching for a more suitable nonlinear equation.

First, we change the settings:

Advanced search settings for nonlinear curve fitting

Next, we click Advanced Search to start the search.

After a short time, the program finds the following equation:

Best nonlinear curve fitting result found by ndCurveMaster
y = 2.63864 + 4.15957·x^-1.45 + 0.63759·x^0.6 + 0.75288·x^1.6

Fitting plot

Curve fitting plot for the final nonlinear model

Model statistics

Regression statistics for the final fitted model

As can be seen, the obtained model describes the data very well, both visually and in terms of regression statistics.

ndCurveMaster project file

The ndCurveMaster project file for this example:
CurveFitting.ndc

Frequently Asked Questions

What is curve fitting?

Curve fitting is the process of finding a mathematical equation that describes the relationship between input data and the output variable as accurately as possible.

Why is polynomial curve fitting not always enough?

A polynomial model may be too limited for more complex data patterns. In such cases, nonlinear curve fitting can provide a much more accurate result.

Can ndCurveMaster fit nonlinear curves automatically?

Yes. ndCurveMaster can automatically search for nonlinear predictor forms and identify equations that fit the data more accurately than a simple polynomial model.

Is this a curve fitting alternative to Excel?

Yes. This example shows that while simple curve fitting can sometimes be done in Excel, more advanced nonlinear curve fitting tasks are often easier and more effective in ndCurveMaster.