Client Account:   Login
Home Site Statistics   Contact   About Us   Tuesday, February 20, 2018

users on-line: 2 | Forum entries: 6   
Pj0182295- Back to Home
   Skip Navigation LinksHOME › AREAS OF EXPERTISE › Curve Fitting Solutions › ~ Straight Line Fit Method

"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 } ]

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();
                 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,


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

Skip Navigation Links.


Home Math, Analysis & More,
  our established expertise..."

  Eigen Inverse Iteration
  Rayleigh-Quotient Method

  Cubic Spline Method
  Newton Divided Difference


Applied Mathematical Algorithms

     Home Complex Functions
A complex number z = x + iy, where...

Complex Functions
     Home Non-Linear Systems
Non-linear system methods...

Non Linear Systems
     Home Differentiation
Construction of differentiation...

     Home Intergration
Consider the function where...


2006-2018 © Keystone Mining Post  |   2461 E. Orangethorpe Av., Fullerton, CA 92631 USA  |