Curve Fitting
Whether you’re using C#, Visual Basic (VB.NET), F#, IronPython, Numerics.NET makes it easy to include curve fitting functionality in your .NET applications. Numerics.NET is a complete math, vector/matrix data analysis, and statistics package for the Microsoft .NET platform. Curve fitting features include:
- Interpolation using polynomials, cubic splines, piecewise constant and linear curves.
- Linear least squares fit using polynomials, Chebyshev polynomials, or arbitrary functions.
- Nonlinear least squares using predefined functions or your own.
- Predefined nonlinear curves: exponential, rational, Gaussian, Lorentz, 4 and 5 parameter logistic.
- Weighted least squares, with 4 predefined weight functions.
- Scaling of curve parameters.
- Constraints on curve parameters.
- Confidence and prediction bands New!
Curve fitting classes
The classes that implement the curve fitting functionality live in the Extreme.Mathematics.Curves namespace. The principal classes are:
Curve Fitting Algorithms
- LinearCurveFitter Represents an algorithm that calculates a linear least squares fit of a curve.
- NonlinearCurveFitter Represents an algorithm that fits a nonlinear curve to data.
- LevenbergMarquardtOptimizer Implements the Levenberg-Marquardt algorithm for non-linear least-squares.
- WeightFunctions Contains a set of standard weight functions that can be used in linear and nonlinear curve fitting.
Curve objects
- Curve Represents a curve in two-dimensional space. This is the abstract base class of all curve objects.
- ParameterCollection Represents the set of parameters that determine the shape of a particular type of Curve.
- Polynomial Represents a polynomial.
- ChebyshevSeries Represents a Chebyshev polynomial series.
- CubicSpline Represents a cubic spline curve.
- GeneralCurve Represents a curve in two-dimensional space whose value is defined by a RealFunction delegate.
- NonlinearCurve Represents a Curve that can be used for a non-linear regression calculation.
The Curve Fitting section of the Mathematics Library User’s Guide explains their use in detail.
Curve Fitting Sample Application
With only a few lines of code, you can fit data points to a set of arbitrary functions. This sample shows you how. For more information, click on the image to the right. This sample is also part of our trial version. |
Curve fitting QuickStart Samples
Our library comes with a large number of QuickStart samples that help you to get started in minutes. The following samples illustrate how to use the curve fitting functionality:
Project | Description | View source | ||
---|---|---|---|---|
LinearCurveFitting | Illustrates curve fitting of polynomials and arbitrary linear functions using linear least squares. | C# | VB.NET | |
NonlinearCurveFitting | Illustrates curve fitting of nonlinear functions using nonlinear least squares. | C# | VB.NET |
Trial version
If you would like to evaluate Extreme Numercs.NET, you can download a free, fully functional 60-day trial version. In addition to the code samples discussed here, it includes about 70 other samples as well as complete documentation for the entire library.