Welcome![Sign In][Sign Up]
Location:
Downloads SourceCode Mathimatics-Numerical algorithms Algorithm
Title: least-squares Download
 Description: * FILE: least-squares.c * This program computes a linear model for a set of given data. * * PROBLEM DESCRIPTION: * The method of least squares is a standard technique used to find * the equation of a straight line from a set of data. Equation for a * straight line is given by * y = mx + b * where m is the slope of the line and b is the y-intercept. * * Given a set of n points {(x1,y1), x2,y2),...,xn,yn)}, let * SUMx = x1 + x2 + ... + xn * SUMy = y1 + y2 + ... + yn * SUMxy = x1*y1 + x2*y2 + ... + xn*yn * SUMxx = x1*x1 + x2*x2 + ... + xn*xn * * The slope and y-intercept for the least-squares line can be * calculated using the following equations: * slope (m) = ( SUMx*SUMy - n*SUMxy ) / ( SUMx*SUMx - n*SUMxx ) * y-intercept (b) = ( SUMy - slope*SUMx ) / n * * AUTHOR: Dora Abdullah (Fortran version, 11/96) * REVISED: RYL (converted to C, 12/11/96)
 Downloaders recently: [More information of uploader xuwenhao2005]
 To Search:
File list (Check if you may need any files):
least-squares.c
    

CodeBus www.codebus.net