Home Login  |   Contact  |   About Us       Thursday, November 28, 2024   

Pj0182295- Back to Home
   Skip Navigation LinksHOME ›  AREAS OF EXPERTISE  #2 ›   Curve Fitting  ›  ~ Straight Line Fit



Skip Navigation Links.



"Curve Fitting Solutions"
Straight Line Fit Method
f(x) =
(constant)  (x)   (standard deviation)


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



[ Initial x-array: { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 } ]
[ Initial y-array: { 1.9, 2.7, 3.3, 4.4, 5.5, 6.5 } ]


IMPLEMENTATION
Curve Fitting Linear Fit

The most popular curve fitting technique is the least squares method. The simplest linear regression is the straight line fit, which attempts to fit a straight line using the least squares technique.

Algorithm Creation

The model function has the following simple form:

f(x;α) = a + bx

where the sum of the linear regression becomes,

S(a,b) = ∑ni=0[yi - f(xi;α]2 = ∑ni=0(yi - a - bxi)2

The standard deviation α can be expressed by,

α = √ S / n - m

Testing the Straight Line Fit Method

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

           static void TestStraightLineFit();
              {
                 ListBox1.Items.Clear();
                 double[] xarray = new double[] { t1, t2, t3, t4, t5, t6 };
                 double[] yarray = new double[] { t7, t8, t9, t10, t11, t12 };
                 double[] x = new double[] { t11, t12, t13, t14 };
                 double[] results = CurveFitting.StraightLineFit(xarray, yarray);
                 VectorR v = new VectorR(results);
                 ListBox1.Items.Add(" " + v.ToString());
              }

As a sample we provide the input data points using two double arrays x-array and y-array. Running this example generates results (1.729, 0.929, 0.191). Therefore, the regression line is given by:

f(x) = 1.729 + 0.929x

and the standard deviation is,

0.191

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


   Quotes

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.

      (About Us) →
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
MINE REVIEW(by G.Pacheco)
Brand





Home

Login

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