Curve Fitting - Elearn.daffodilvarsity.edu.bd

1y ago
8 Views
2 Downloads
534.36 KB
10 Pages
Last View : 28d ago
Last Download : 3m ago
Upload by : Oscar Steel
Transcription

CURVEFITTINGOhidujjamanMd.Mehedi HasanLecturer (Mathematics)Department of Natural SciencesDaffodil International University

Curve fitting:Curve fitting is the process of constructing a curve (named as an approximating curve) or mathematical function that hasthe best fit to a given set of data points, possibly subject to constraints. In this case the curve drawn is such that thediscrepancy between the data points and the curve is least. The method of least squares is most commonly used in fittingcurve.OrCurve Fitting is most often used by scientists and engineers to visualize and plot the curve that best describes the shape& behavior of their data. Curve fitting is the procedure in finding a curve which matches a series of data points andpossibly other constraints.OrA procedure in which the basic problem is to pass a curve through a set of points, representing experimental data, insuch a way that the curve shows as well as possible the relationship between the two quantities plotted. It is alwayspossible to pass some smooth curve through all the points plotted, but since there is assumed to be some experimentalerror present, such a procedure would ordinarily not be desirable.The methodsuggestedcentury by the French mathematician Adrien Legendre.curve fitting wasearly in the 19thLeast Squares Method:The least squares method is the most systematic procedure to fit a unique curve through the given data pointsand its widely used universally in practical computations. The method of least squares assumes that the best-fitcurve of a given type is the curve that has the minimal sum of the deviations squared (least square error) froma given set of data.Suppose that the data points are x1 , y1 , x2 , y 2 , x3 , y3 , , xn , y n where x is the independentvariable and y is the dependent variable. The fitting curve y f (x) has the deviation (error/residual) d fromeach data point, i.e., d1 y1 f ( x1 ), d 2 y 2 f ( x2 ), , d n y n f ( xn ). It is clear that someof the residuals will be positive and the remaining will be negative. Hence to give equal importance to positiveand negative residuals we square each of them and form the sum of squares.Now the sum of the squares of the errors or deviations is,S d1 d 2 d n222S y1 f ( x1 ) y2 f ( x2 ) yn f ( xn ) 2n2S yi f ( xi ) 22[Must be Minimum for Best Fitting]i 1The quantity S provides a measure of the goodness of fit of the curve to the given data if it is very minimumand if it is large then the curve fitting is bad. For S 0 each of the given points lies on y f (x) and it willdecrease in value depending on the closeness of the points to the curves.Md. Mehedi Hasan, Lecturer (Mathematics), DIU1

Therefore, the best representative curve to the given data set of points is that for which the sum of squares ofthe errors S is minimum. This is known as the least Square method /Criterion or the principle of least squares.Note:Least squares curves fitting are of two types such as linear and nonlinear least squares fitting to given data xi , yi , i 1,2, , n according to the choice of approximating curves f (x) as linear or nonlinear. Theconstant occurring in the equation y f (x) of the approximating curve can be found by several methodsmentioned in the followings:1.Graphical Method2.The method of group average3.Method of least squaresLinear curve fittingFitting a straight line:Fitting a straight line means finding the values of the parameters a and b of the straight line y ax b as wellas actually constructing the line itself. The graphical method and least square method are two useful methodsfor finding a straight line.Let us consider n data points xi , yi , i 1,2, , n and a linear function y ax b in x and y that representsa straight line best fit to the given data. We have to find the constants a and b. For any x i the expected valueof y (Value calculated from the equations) is a bxi and observed value of y is y i .Therefore, the deviation/error/residual d i yi (axi b) ,by giving values i 1,2, , n we get the variousresiduals.Now the sum of the squares of the errors or deviations is,222S d1 d 2 d nS y1 (ax1 b) y2 (ax2 b) yn (axn b) 2n2S yi (axi b) 22[Must be Minimum for Best Fitting]i 1The quantity S provides a measure of the goodness of fit of the curve to the given data if it is very minimum. S S 0 and 0.For S to be minimum the conditions are a bPartially differentiating S with respect to a and b, we getn S 2 yi (axi b) xi a i 1n S 2 xi yi (axi b) a i 1Andn S 2 yi (axi b) 1 b i 1n S 2 yi (axi b) b i 1For satisfying the conditions above equation equating with zero, we findn 2 x yi 1ii (axi b) 0Md. Mehedi Hasan, Lecturer (Mathematics), DIU2

n 2 xi yi (axi b) 0i 1n x yi 1ni x yii 1ni (axi b) 0i (axi bxi ) 0 2n x y (axi 1niii 1n2i bxi ) 0na xi b xi xi yi (i)2i 1i 1i 1Andn 2 yi 1ni (axi b) 0 2 yi (axi b) 0i 1n yi 1ni (axi b) 0n yi (axi b) 0i 1ni 1n (axi b) yii 1nni 1n ax b yi 1nii 1i 1ina xi bn yi (ii)i 1i 1We represent the equations (i) and (ii) in matrix form n 2 n n xx i i a x i y i i 1 i n1 i 1n b x nyi i i 1 i 1 n 2xi a i 1 n b xi i 1 xi i 1 n n 1 n x i y i i 1n yi i 1 n a n b nnn x n x2 xi ii xi i 1i 1i 1i 11n n x i x i y i i 1 i 1n n2 xiyi i 1 i 1Md. Mehedi Hasan, Lecturer (Mathematics), DIU 1 a b 1 d b , ad bc 0 c d ad bc c a 3

nnn nxy xyi iii i 1i 1i 1 nnn n x2 x ii xi a i 1i 1i 1 nnnn b x2 y x i ii xi y i i 1 i 1i 1i 1nnn n xi 2 xi xi i 1i 1i 1Now equating the two equal matrices we get,nnni 1ni 1ni 1nn xi yi xi yia n xi xi xi2i 1i 1n i 1nnn xi yi xi yii 1i 1i 1 n xi xi i 1 i 1 nn22 x n n xi yi n x n yi 1n n xi n x22i 1nn xi y i n x yn x y2 i 1nn xi n x2nnni 1i 122 i 1ni xi 1i 1i2i n x i n i 1 nx y n x2Andb xi2i 1n y i xi xi y ii 12 2n xi xi i 1 i 1 nnnny n xi n x xi y i2i 1ni 1 n xi n x22i 1ny n xi x xi y i2i 1n xi 1i 12i n x2Md. Mehedi Hasan, Lecturer (Mathematics), DIU4

Putting this values of a and b in the equation y ax b we get the equation of the line best fitting the data asy ax b .Note:nnnnni 1i 1i 1i 1The equations a xi b xi xi yi and a xi bn yi are called the normal equations.i 12Dropping of the suffices above equation can be written as a x 2 b x xy and a x bn yMathematical problem on Linear curve fittingProblem 01: Use the method of least squares to fit a straight line to the following data:x05101520y711162026Estimate the value of y when x 25.Solution:Assume that the least square straight line to be fitted to the given data be y ax b .Then we have the normal equations area x 2 b x xy (i)anda x bn y (ii)Here the number of data points n 5.Calculation for finding the coefficients a and b of the least square line.x05101520 x 50y711162026 y 80xy055160300520 xy 1035x2025100225400 x2 750Now putting these values in the above equations (i) and (ii) we get750a 50b 1035 and 50a 5b 80Solving above two equations by calculator, we get values of a 0.94 and b 6.6 .Putting these values in the equation y ax b we get the required line as y 0.94x 6.6 .Expected value of y 0.94 25 6.6 30.1 as x 25 .(As desired)Problem 02: Find the least square line y ax b for the data points 1,10 , 0,9 , 1,7 , 2,5 , 3,4 , 4,3 5,0 and 6, 1 .Solution:Given that least square straight is y ax b and number of data points n 8.Then we have the normal equations area x 2 b x xy (i)anda x bn y (ii)Calculation for finding the coefficients a and b of the least square line.Md. Mehedi Hasan, Lecturer (Mathematics), DIU5

x-10123456 x 20y10975430-1 y 37xy-10071012120-6 xy 25x210149162536 x2 92Now putting these values in the above equations (i) and (ii) we get92a 20b 25 and 20a 8b 37Solving above two equations by calculator, we get values of a 1.60714 and b 8.64286 .Putting these values in the equation y ax b we get the required line as y 1.60714 x 8.64286 .(As desired)Another Method of finding Equation of Line:Use the following steps to find the equation of line of best fit for a set of ordered pairs (x1, y1), (x2, y2), .,(xn, yn).Step 1: Calculate the mean of the x-values and the mean of the y-values.Step 2: The following formula gives the slope of the line of best fit:Step 3: Compute the y-intercept of the line by using the formula:Step 4: Use the slope m and the y-intercept b to form the equation of the line.Problem 03: Use thethe equation of line ofline.least square method to determinebest fit for the data. Then plot theSolution:Plot the points onMd. Mehedi Hasan, Lecturer (Mathematics), DIUa coordinate plane.6

Calculate the means of the x-values and the y-values.Now calculate xi X , yi Y , ( xi X )( yi Y ) and ( xi X ) 2 for each i.Calculate the slope.Md. Mehedi Hasan, Lecturer (Mathematics), DIU7

Calculate the y-intercept.Use the formula to compute the y-intercept.Use the slope and y-intercept to form the equation of the line of best fit.The slope of the line is –1.1 and the y -intercept is 14.0.Therefore, the equation is y –1.1 x 14.0.Draw the line on the scatter plot.Problemsfor1.Find the least square line y ax b for the datax-2-10y123practicing:13242. Find the values of a0 and a1 so that y a0 a1 x fits the data given in the table:x01234y12.94.86.78.63.Fit a straight line of the form y a0 a1 x to the data:x123y2.43.13.544.265864.The table below gives the temperature T (in 00C) and length l (in mm) of a heated rod. If l a0 a1T findthe values of a0 and a1 using linear least squaresT4050607080600.5600.6600.8600.9601l5.Find the least square line y ax b for the datax-4-201.22.86.2y27.8413.26.Fit a straight line to the following data regarding x as the independent variablex01234Md. Mehedi Hasan, Lecturer (Mathematics), DIU8

y11.83.34.56.37.Find the least square fit straight line of the form y ax b for the data of fertilize application and yield ofa plantfertilizer01020304050.8.81.31.61.71.8Yield (kg)Md. Mehedi Hasan, Lecturer (Mathematics), DIU9

the errors S is minimum. This is known as the least Square method /Criterion or the principle of least squares. Note: Least squares curves fitting are of two types such as linear and nonlinear least squares fitting to given data x i, y i ,i 1,2,! ! ,n according to the choice of approximating curves f(x) as linear or nonlinear. The

Related Documents:

1. QUADRATIC E Q UATIONS eLearn.Punjab 1. QUADRATIC E Q UATIONS eLearn.Punjab 8 9 eLearn.Punjab 1 eLearn.Punjab 1 11 11 It will be easier for us to understand the above method with

behringer ultra-curve pro dsp 24 a/d- d/a dsp ultra-curve pro ultra- curve pro 1.1 behringer ultra-curve pro 24 ad/da 24 dsp ultra-curve pro dsp8024 smd (surface mounted device) iso9000 ultra-curve pro 1.2 ultra-curve pro ultra-curve pro 19 2u 10 ultra-curve pro ultra-curve pro iec . 7 ultra-curve pro dsp8024 .

Part 5 - CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for curve fitting: Least Squares regression: Data exhibit a significant degree of scatter. The strategy is to derive a single curve that represents the general trend of the data .

polynomial curve fitting. Polynomials are one of the most The Polynomial Curve Fitting uses the method of least squares when fitting data. The fitting process requires a model that relates the response data to the predictor data with one or more coefficients. The result of the fitting process is an estimate of

I. METHODS OF POLYNOMIAL CURVE-FITTING 1 By Use of Linear Equations By the Formula of Lagrange By Newton's Formula Curve Fitting by Spiine Functions I I. METHOD OF LEAST SQUARES 24 Polynomials of Least Squares Least Squares Polynomial Approximation with Restra i nts III. A METHOD OF SURFACE FITTING 37 Bicubic Spline Functions

Keywords Curve fitting · Surface fitting · Discrete polynomial curve · Discrete polynomial surface · Local optimal · Outliers 1 Introduction . The method of least squares is most commonly used for model fitting. This method estimates model parameters by minimizing the sum of squared residuals from all data, where

For best fitting theory curve (red curve) P(y1,.yN;a) becomes maximum! Use logarithm of product, get a sum and maximize sum: ln 2 ( ; ) 2 1 ln ( ,., ; ) 1 1 2 1 i N N i i i N y f x a P y y a OR minimize χ2with: Principle of least squares!!! Curve fitting - Least squares Principle of least squares!!! (Χ2 minimization)

Each reference should include everything you need to identify the item. You need to identify the source type (e.g. book, journal article) and use the correct referencing format from this guide to create the reference. If you include items that are not specifically cited but are relevant to the text or of potential interest to the reader, then that is a bibliography. Generally speaking, the key .