+ All Categories
Home > Documents > 4curve Fitting Techniques

4curve Fitting Techniques

Date post: 26-Sep-2015
Category:
Upload: subhankarganguly
View: 6 times
Download: 0 times
Share this document with a friend
Description:
curve fitting techniques document
Popular Tags:
50
CURVE FITTING TECHNIQUES Introduction Engineering problems involve collection of experimental data and make use of them in designing an engineering system. Assume that the data set consist of ‘n’ measurements, D = {(x k ,y k ), k=1,2..n), where, x 1 < x 2 .. < x i .. < x n . Fitting an appropriate function or curve y = f(x) to the data set is often very helpful. Once this is done, various types of manipulations may be made. Some of the important applications are in Prediction of the value of y for x other than at the sample points; if x 1 < x < x n , the process is known as
Transcript

CURVE FITTING TECHNIQUES

Introduction

Engineering problems involve collection of experimental data and make use of them in designing an engineering system. Assume that the data set consist of n measurements,

D = {(xk,yk), k=1,2..n), where, x1 < x2.. < xi.. < xn.

Fitting an appropriate function or curve y = f(x) to the data set is often very helpful. Once this is done, various types of manipulations may be made. Some of the important applications are in

Prediction of the value of y for x other than at the sample points; if x1 < x < x n, the process is known as interpolation and if x is beyond the range of data set, the process is termed as extrapolation.

Predicting the maximum and minimum values of the function in the range x1 < x < x n Finding the derivative, integral, etc. of the function.

Replacement of a complicated mathematical function by a simpler equivalent. In this application, the data points are generated directly from the complex function by calculation.

Sometimes it becomes necessary to fit a certain function to some experimental data, which may contain random noise generated by the sensors. The effect of the noise might be effectively minimised by performing more measurements than the bare minimum and finding a reliable model of the system as discussed below:

Least Square Fit:

Data set derived from experimental measurements, may contain a random component due to noise generated in the sensor. To obtain a good estimate of the parameters of the system, a relatively large number of measurements are to be made, in comparison to the degree of freedom of the system.

In such cases, it is more appropriate to find a curve that describes the underlying trend of the data without the necessity of having to pass through each data point. The type of curve, usually a polynomial, used for this purpose shall depend upon the nature of the underlying physical system that generates the data. The function f(x) that relates x with y should be such that the sum of the squared errors is minimized; Mathematically this may be stated as:

Find f(x) so that sum of the weighted square of the errors

E(a)=k=1,n wk{ f(xk) yk}2Is minimised, where the data set D= {(xk,yk), k=1,n} and wk> 0, denotes a weighing factor indicating confidence level of the kth data in the set D. The polynomial f(x) which minimises E(a) is referred to as the weighted least-square fit. Often the weighing factors are all taken to be 1. Although alternative error criteria could be defined, it is the least-square criterion that is generally preferred.

Straight Line Fit

In case the system behaviour is such that a straight line represents input-output relation this functional relation may be expressed as

f(x) = a1 + a2. x

The process of weighted least square fit consists in calculating the coefficients, a1 and a2, of the polynomial f(X) so as to minimise

E (a1,a2) = k=1,n wk{ f(xk) yk)}2 = k=1,n wk{ (a1 +a2.xk yk)}2The necessary and sufficient conditions for this is

E/a1 = 2. k=1,n wk (a1 +a2.xk-yk) = 0 , and

E/a2 = 2. k=1,n wk(a1 +a2xk-yk).xk = 0

Above two equations may be written in matrix form as:

. =

The coefficient matrix on the left hand side depends on the weighing factors and the independent variable but the right hand side depends upon the weighing factor, independent and dependent variables.

Example: Find a least square straight line fit to the data set D ={(0,2.1), (1,2.85),(2.3.10),(3,3.20),(4,3.90)}

Soln:

The elements of the coefficient matrix have been computed (assuming wk =1, k=1,2,..,5) as:

c11 = k=1,n wk = 1+1+1+1+1= 5

c12 =c21= k=1,n wk.xk = (0+1+2+3+4) x1 = 10

c22 = k=1,n wk.xk2 = (0+1+4+9+16) x 1 = 30

The elements of the vector B of the right hand side have values:

b1 = k=1,n wk.yk = (2.10+2.85+3.10+3.20+3.90) x 1 = 15.15

b2 =k=1,n wk.xk.yk = (0 x 2.10+1 x 2.85+2 x 3.10+ 3 x 3.20+ 4x 3.90) x1 = 34.25

The linear system of equations to be solved to determine a1 and a2 are

. =

The solution to the above set is a1 = 2.24 and a2 = 0.395

So the required least-square fit is y = f(x) = 2.24 + 0.395 x

Polynomial Fit:

In case the underlying trend of the data is to be modeled with a (m-1)th degree polynomial f(x), involving m coefficients, as f(x) = a1+a2.x2+ .. +ajxj-1 ..+ amxm-1

Suppose, n> m measurements have been made to generate a set of n data points. The method of straight line fit may be extended to fit this polynomial to the data set with least square error. Using weightage wk for the kth data, the weighted sum-squared error in this case may be written as

E= k=1,nwk{f(xk)-yk}2

= k=1,nwk{ a1+a2.xk2+ .. +ajxkj-1 ..+ amxkm-1-yk}2

for optimum choice of the coefficients, a1, a2,aj, an , following conditions need be satisfied:

E/aj=2.k=1,nwk{a1+a2.xk2+ ..+ajxkj-1..+ amxkm-1-yk}.xjj-1} = 0 , j =1,2,,m

The set of m equations written above may be presented in matrix form as, [each summation extends over n terms]

. =and solved for ai for i=1,2.m

The above set of equations may now be solved for m constants, a1, a2, .aj, am.Example: Find a polynomial of degree 2 to fit to the data set with least square error.

D ={(0,-3),(0.5,-2.5),(1,-1),(1.5,1.5),(2.0,5.0)}, assume, wk =1, k=1,2..5

Soln: The elements of the coefficient matrix C are

c11 = wk = 5; c12 = wk.xk = 5.; c13 = wk.xk2 = 7.5

c21 = wk.xk = 5; c22 = wk.xk2 = 7.5; c23 = wk.xk3 = 12.5

c31 = wk.xk2 = 7.5 c32 = wk.xk3 = 12.5 c33 = wk.xk4 = 22.125

elements of the right hand side vector are

b1 = wk.yk = 0; b2 = wk.xk.yk = 10.00; b3 = wk.xk2 .yk = 21.75

Solution of the equation C.A = B is

A=C-1.B = [-2.1143 -1.5429 2.5714]

So the required 2nd. degree polynomial is

f(x) = - 2.1143 - 1.5429.x + 2.5714. x2

Interpolation and Extrapolation

The problem basically consists in determination of a function f(x) such that it passes through the given set of data D={(xk,yk), k=1,2,,n}, and hence determining y for any value of x. It is presumed that x1


Recommended