Home Login  |   Contact  |   About Us       Tuesday, May 17, 2022   

j0110924 - Back to Home
   Skip Navigation LinksHOME ›  AREAS OF EXPERTISE ›   Curve Fitting  ›  ~ Polynomial Fit



Skip Navigation Links.



"Curve Fitting Solutions"
Polynomial Fit Method


x-array = { , , , , , }
y-array = { , , , , , }



[ Initial x-array: { 0, 1, 2, 3, 4, 5 } ]
[ Initial y-array: { 2, 1, 4, 4, 3, 2 } ]
                       

IMPLEMENTATION
Polynomial Fit Method

As we mentioned before, please refer to ("Straight Line Fit Method") the polynomial fit is a special case of the linear least squares methods.

Algorithm Creation

In this case, the basis function becomes:

fj(x) = xj,    j = 0,1,...,m

where the matrix and vector in the normal equation become,

Αjk = ∑ni=0  xjj + k,     βk = ∑ni=0  xik yi

Testing the Polynomial Fit Method

In order to test the Polynomial Fit Method as defined above, a new TestPolynomialFit() static method has been added and executed. Supporting code and methods are not shown.

           static void TestPolynomialFit();
              {
                 ListBox1.Items.Clear();
                 double[] xarray = new double[] { t1, t2, t3, t4, t5, t6 };
                 double[] yarray = new double[] { t7, t8, t9, t10, t11, t12 };
                 {
                    double sigma = 0.0;
                    VectorR results = CurveFitting.PolynomialFit(xarray, yarray, m, out sigma);
                    ListBox1.Items.Add("\nOrder of polynomial m = " + m.ToString() + ",
                       Standard deviation = " + sigma.ToString());
                    ListBox1.Items.Add("Coefficients = " + results.ToString());
                    ListBox1.Items.Add(" ");
                 }
              }

As a sample we provide the input data points using two double arrays x-array and y-array. We used the same input function as in ("Straight Line Fit Method"). Running this example generates results shown above. Note the order of the polynomial is given by simple iteration from 1 to 3.

From these results we see that the quadratic polynomial with m = 2:

f(x) = 1.2857 + 1.6x - 0.2857x2

produces the smallest deviation, which can be considered as the best fit to the data.

The user can manipulate all values and try variations on the arrays themselves by specifying new estimate values.



Other Implementations...


Object-Oriented Implementation
Graphics and Animation
Sample Applications
Ore Extraction Optimization
Vectors and Matrices
Complex Numbers and Functions
Ordinary Differential Equations - Euler Method
Ordinary Differential Equations 2nd-Order Runge-Kutta
Ordinary Differential Equations 4th-Order Runge-Kutta
Higher Order Differential Equations
Nonlinear Systems
Numerical Integration
Numerical Differentiation
Function Evaluation


Consulting Services - Back to Home
Home

Home Math, Analysis,
  expertise..."

EIGENVALUE
SOLUTIONS...


> Rayleigh-Quotient Method

> Cubic Spline Method

 

Applied Mathematical Algorithms

Home

ComplexFunctions

Home

NonLinear
Home

Differentiation
Home

Integration
About Us


KMP Software Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.
Areas of
Expertise


SpecialFunctions
VectorsMatrices
OptimizationMethods
ComplexNumbers
Interpolation
CurveFitting
NonLinearSystems
LinearEquations
DistributionFunctions
NumericalDifferentiation
NumericalIntegration
DifferentialEquations
Smalltalk
FiniteBoundary
Eigenvalue
Graphics
Understanding
Mining


MiningMastery
MineralNews
MineralCommodities
MineralForum
Crystallography
Services


NumericalModeling
WebServices
MainframeServices
OutsourceServices

LINKED IN
KMP ARTICLES
Brand





Home

Login

Contact
Since 2006 All Rights Reserved  © KMP Software Engineering LINKS | PRIVACY POLICY | LEGAL NOTICE