Skip to main content Skip to docs navigation

Curve Fitting Online

   Curve fitting online has never been easier. Fit your data by entering it below and pressing run. This curve fitting tool uses the Levenberg–Marquardt algorithm to find the best fit of 88 equations.
Updated: 12/21/2024

Step 1 Paste Your Data  

Step 2 Run  

Step 3 Review Your Results

Step 4 Click 'Next' to See Other Equations.
Hold Button Down to Cycle Automatically.  



Calculating!

Step 5 Review Your Leaderboard:

Step 6 Try a Different Set of Data  



Step 7 Advanced - Set Number of Iterations  



Step 8 Read All About It:

How to Calculate Nonlinear Regression Online

   Use our online fully automatic nonlinear curve fitting calculator! It has 88 builtin functions, and finds the best ones! Just paste your data into the input field below and press Run to find the best fit for your data.
Sample data has been provided for you to test out this tool.
The first time you load this webpage the tool runs our sample data so you can see how it works.
Just press the Run button to run the tool again.
To run your dataset, replace our demo data with your data and press the run button.

What is The Best Fit Curve?

   The best curve fit to your data is one that has the lowest error while also not being overfit. Certain equations are flexible enough that they can be bent into wild shapes to fit your data. This can be seen when fitting with polynomial equations of the same order as there are data pairs or rows. What happens is the equation is likely to perfectly pass through each data pair, but do a horrible job of extracting the trend of the data. The equation is just so "flexible" that the spaces inbetween will go off in wild directions. This is why we intentionally left out higher order polynomials due to this overfitting issue. If the dataset wasn't long enough, they would always float to being number one, while at the same time would be wildly over fit. We have a few equations in our list of 88 that will do this for datasets of less that 5 data pairs long. We've left them in, as it's very plain to see when this happens with these in particular.

Curve of Best Fit Calculator

   Our Online curve fitting tool is really a best fit finder. By having a large collection of equations that have been carefuly slected for not being likely to over fit and trying to fit your data against all of these great equatoins, what you end up with is finding the best fit possible for your data.

How to Determine a Model to Fit Data?

   One way to find which model to use is to brute force it and try all obvious options. This is exactly how our curve fitting application works. It finds the best model for your data by trying 88 of the most common functions and sorts them by how well they did.

How to Test How Well a Model Fits Data?

   One of the best ways to compare and review the goodness of fit of different models is to compare the Sum of Squared Residuals, or SSR. This is a direct measure of how much the fit is off from the data. SSR of zero would mean a perfect fit. For linear models, R Squared works well, but this parameter only works for fitting straight lines, as it uses the mean of the data as a basis point to compare against.

Nonlinear Curve Fitting Online Methodology

   This tool is an automatic version of Nonlinear Least Squares Curve Fitting and the four parameter version: Nonlinear Least Squares Curve Fitting - 4 parameter version created by Tom Shattuck, Department of Chemistry, Colby College.

   The Levenberg-Marquardt algorithm that this page uses blends two popular algorithms together to get the best of both. It interpolates between Gauss–Newton and Gradient Descent. In Gradient Descent the algorithm moves in the direction of the steepest gradient of the sum of the squared error by adjusting the parameters. In Gauss-Newton the sum of the squared error is approximated with a quadratic function and the minimum of that quadratic function is solved for. The Levenberg-Marquardt method starts off behaving like Gradient Descent when it is far away from the solution and as it approaches the optimal values for the parameters it begins to act more like the Gauss-Newton method. This behavior gives you the best of both worlds, quick convergence and fine adjustment as you get close.

Nonlinear Curve Fitting Use Cases

   Our O-Ring Groove Design Tool was made using this tool. It helped us find a function to describe how an o-ring's cross-section is reduced as its inner-diameter is stretched. This is where curve fitting really has value. If you have a physical system and have collected data about some element of its reaction to an input then you can use a tool like this to find what mathematical equations best fit the data. Another example of this would be analyzing how coffee brews using a conductivity probe. The conductivity of the coffee as it's brewing goes up both linearly and exponentially. These two separate mathematical functions combine together to match the test data exactly. Discovering this shows how coffee brewing is a combination of brownian motion and diffusion with brownian motion contributing in a linear way to the conductivity and diffusion contributing in an exponential way.

How to Save Time With Curve Fitting Tabulated Data

   Another use for this type of software is converting tabulated data into an equation for use in an excel design sheet. One great example of this is rubber springs with Firestone Marsh Mellow™ Isolators being a leading choice. The way these springs behave is not at all linear. The applied load, height and spring rate are all listed in terms of % compression in a table. Each spring has its own unique table. An enterprising engineer would be wise to convert this tabulated data into functions that could be placed into excel and used in a larger program. The result of this is your engineering department would now be free of having to look up these tables every time they went to design something new, a major time savings.
   There is another reason to curve fit tabulated data and it's to unlock possible hidden physics! Looking at tables that list the torque applied to a bolt in relation to how much clamp force that particular bolt's thread size produces highlights something interesting. It seems that bolt clamp force varies mostly linearly with nominal thread diameter, who knew!

How to Calculate R2 for Nonlinear Regression

   In a nonlinear curve fitting problem, the meaning of R2 breaks down, so it should never be used to choose the best model. Instead the Sum of the Squared Residuals should be used to find the best fit. This is what our tool uses.
That being said, R2 can be calculated by taking 1 and subtracting the Sum of the Squared Residuals (SSR) divided by the Max possible for the Sum of the Squared Residuals.

The way we calculate this is first finding the Max of the Sum of the Squared Residuals (Max_SSR) as simply the y values squared and then added

  Max_SSR=Sum((y_actual)^2)

Next find the SSR by calculating the error at each point, squaring that, and then adding them all up.

  SSR=Sum((Y_actual-Y_estimated)^2)

After that:

   R2 = 1-SSR/Max_SSR.

Again, R2 is only valid for linear fitting, so we suggest that you don't use R2 for Nonlinear regression as that can lead to mixed results when comparing one alternative fit to another.


How to Calculate Nonlinear Regression in Excel

Setting up a nonlinear regression in excel is easy!
It's all about getting your columns right.
First column (A) is your x variable (input)
Second column (B) is your y data (output)
Third column (C) is your curve fitting equation that takes in the x next to it and your coefficients stored in column 6. Be careful to use $ to make those coefficients static/fixed so you can drag the first cell you make down to fill up the whole range.
Fourth column (D) is the square of the error at each point. so (Y_actual-Y_estimated)^2
Fifth column (E) we only use one cell, and that should equal the sum of the squared errors =Sum( column 4 (D) ).
sixth column (F) should store all of your coefficients, each in its own cell, and ideally next to each other.
Lastly use excel's builtin solver to minimize the SSR in column 5 (E) by adjusting the coefficients in column 6 (F).
It's been said that Excel uses Gauss-Newton, Which if true means you should get the same results in excel as you do here.
But hey, Why bother with Excel when you've got this calculator ready to go at a moment's notice!

Nonlinear Curve Fitting Resources

Free Curve Fitting Software

Links to free and proprietary curve fitting software. An excellent list of curve fitting software available.
Gnuplot Wiki A very mature graphing and curve fitting program.
Nonlinear Least Squares Curve Fitting. Our tool was based on this one. created by Tom Shattuck, Department of Chemistry, Colby College.
Nonlinear Least Squares Curve Fitting - 4 parameter version created by Tom Shattuck, Department of Chemistry, Colby College.
SciPy.optimize.curve_fit SciPy is a Free python package that uses Minpack behind the scenes. It's great software.
Minpack Minpack by Netlib is free software written in fortran.
CMinpack Github CMinpack is a C++ rewrite of Minpack
CMinpack Creator CMinpack Homepage
An important quote from the Cminpack creator Frédéric Devernay:
"There is now a very powerful alternative to MINPACK, which is the Ceres Solver. You may want to consider using Ceres for any new project."
Ceres Solver Is a very powerful new solver / optimizer built by Google.

Paid Curve Fitting Software

In order of least expensive to most expensive:
CurveExpert Pro A great tool, it uses python on the backend to calculate a group of functions to help you find the best one.
Sigmaplot Is great for scientists. It has extensive statics builtin.
JMP Is also great for scientists. Also has extensive statics builtin.
Minitab Is also great for scientists. has the most extensive statics builtin.

Curve Fitting References

The Levenberg-Marquardt algorithm for nonlinear least squares curve-fitting problems by Henri P. Gavin

Latest Tools

Curve Fitting Online

O-Ring Groove Design


Disclaimer

Recommendations on application design and material selection are based on available technical data and are offered as suggestions only. Each user should make their own tests to determine the suitability for their own particular use. Standards Applied LLC offers no express or implied warranties concerning the form, fit, or function of a product in any application.

Third-party trademarks are the property of their respective owners and are used on this website for informational purposes only. No affiliation with, and no sponsorship or endorsement by, such third-party trademark owners is claimed or implied.