0% found this document useful (0 votes)
124 views44 pages

Chaper Five: Curve Fitting

The document discusses different methods for curve fitting and interpolation of data points. It describes least squares regression techniques, including linear, polynomial, exponential, and power functions to fit a curve to the general trend of data. It also covers interpolation methods, such as Newton's divided differences, Lagrange polynomials, and spline interpolation, which pass curves through each data point. Examples are provided to illustrate fitting curves and determining values between data points using these various techniques.

Uploaded by

Fekadu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views44 pages

Chaper Five: Curve Fitting

The document discusses different methods for curve fitting and interpolation of data points. It describes least squares regression techniques, including linear, polynomial, exponential, and power functions to fit a curve to the general trend of data. It also covers interpolation methods, such as Newton's divided differences, Lagrange polynomials, and spline interpolation, which pass curves through each data point. Examples are provided to illustrate fitting curves and determining values between data points using these various techniques.

Uploaded by

Fekadu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

CHAPER FIVE

CURVE FITTING

1
5.1 Introduction

Data is given for discrete values along continuum.


If estimates between these discrete values is required
Formulate a function that fits these values approximately  CURVE FITTING

Two general approaches of curve fitting


Derive a single curve that represents the general trend of the data
(Least-squares regression)
Fit a curve or a series of curves that pass directly through each point
(Interpolation)

2
5.2. Least-squares regression
Fit the general trend of the data without necessarily matching the individual points
Minimize the sum of the squares of the discrepancies between the fitted curve and each data point

Linear regression

Given data: (x0 , y0), (x1 , y1), ….., (xn , yn)

Curve fit: Straight line

Mathematical expression: y = ao + a1x + e

Error or Residual

Discrepancy between the true value of y and the approximate value, ao + a1x

e = y – ao – a1x
3
The residual in linear regression represents the vertical distance between a data
point and the straight line. 4
5.2. Least-squares regression
Sum of the squares of the discrepancies is given by:

Sr = 2

Minimum value of sr is obtained by


= -2

=-2 

Unknowns ( and ) determined


=

= -

Where are the mean values of x and y, respectively 5


5.2. Least-squares regression

Goodness of the fit


Standard error of the estimate,

Quantified by the value of coefficient of correlation r ( coefficient of determination)


=

Where is the total sum of the squares around the mean for the dependent variable
Alternative formula

r=
A value r closer to one indicates a good fit.

6
5.2. Least-squares regression

7
8
5.2. Least-squares regression
Polynomial regression

9
5.2. Least-squares regression

10
5.2. Least-squares regression
• 

11
5.2. Least-squares regression
Curve fit: Second order polynomial or quadratic (y = ao + a1x + a2x2 + e)
 From = 0 (i = 0, 1, 2), we get equations:
nao + a1 + a2 =

ao + a1 + a2 =

ao + a1 + a2 =

 By rearranging in a matrix form


=

12
Example

C#5 A material is tested for cyclic fatigue failure whereby a stress, in


MPa, is applied to the material and the number of cycles needed to cause
failure is measured. The results are in the table below.

N, cycles 1 5 10 100 1000 5000


Stress, MPa 95 75 65 45 30 25

13
Example
1. Use the following least-square regressions to determine a best-fit
equation for this data.
a. Linear regression method
b. Quadratic regression method
c. Exponential equation
d. Power equation

2. From the above curve fits which one is the best fit for the given data? Why?

3. Determine the number of cycles needed to cause failure when the material is
applied to stress of 50 MPa? 14
Solution #1
a. Linear regression method
y = ao + a1x

Where =

= -

15
a. Linear regression method
Quantify the goodness of the fit.

16
b. Quadratic regression method
y = a o + a 1 x + a 2 x2

17
b. Quadratic regression method

18
b. Quadratic regression method
Quantify the goodness of the fit.

=
19
c. Exponential function

20
c. Exponential function

21
c. Exponential function

22
c. Exponential function
Test of goodness

23
d. Power function

24
d. Power function

25
d. Power function

26
d. Power function
Test of goodness

27
Solution #2

28
Solution #3
The number of cycles needed to cause failure when the material is applied
to stress of 50 Mpa is determined by using curve fit equation of power
function

29
5.3. Interpolation
Estimates intermediate values between precise data points
For n+1 data points, there is only one polynomial of order n that passes
through all the points

fn(x) = ao + a1x + a2x2 + ……… + anxn

Newton’s divided-difference interpolating polynomials

a. Linear interpolation
 Connect two data points with straight line (SNS)
f1(x) = f(xo) +

30
Graphical depiction of linear interpolation. The shaded areas indicate the similar triangles used
to derive the linear-interpolation formula
31
5.3. Interpolation

b. Quadratic Interpolation
If three data points are available  a second order polynomial
(quadratic polynomial or a parabola).
f2(x) = bo+ b1(x-xo) + b2(x-xo)(x-x1)

Determine the values of the coefficients


x = xo bo = f(xo)

x = x1 b1=

x = x2  b2 =

32
5.3. Interpolation
c. General form of Newton’s interpolating polynomials
Fit an nth-order polynomial to n+1 data points ((x0, ), (x1 , ), ….., (xn , ))
 fn(x) = bo + b1(x-xo) + …………+ bn(x-xo)(x-x1) …… (x-xn-1)

 Evaluation of coefficients.
bo = f(xo)  

b1=  =

b2= =
.
.
.

bn = =

33
5.3. Interpolation
Lagrange interpolating polynomial

Reformulation of the Newton’s polynomial that avoids


the computation of divided differences
=
Where =

34
5.4. Spline interpolation (READING ASSIGNMENT)
High-order polynomial functions can lead to erroneous results due to round-off error and overshot
Apply lower – order polynomials to subsets of data points

a. Linear Splines

The simplest connection between two points is straight line


f(x) = f(xo) + mo(x – xo) x o x x1

f(x) = f(x1) + m1(x – x1) x 1 x2


.
.
.

f(x) = f(xn-1) + mn-1(x – xn-1) xn-1 x xn

Where mi is the slope of the straight line connecting the points:

mo =

35
Example
Redo Example C#5

4. By using the following interpolations (NDD) determine the applied


stress when the number of cycles needed to cause failure is 50.
a. Linear interpolations

b. Quadratic interpolations

5. Fit all data points with polynomial

6. By using the second order Lagrange interpolation determine the applied


stress when the number of cycles needed to cause failure is 50.
36
Solution #4
NDD Interpolations

37
Solution #4
a. Linear interpolations

38
Solution #4
b. Quadratic interpolation

39
Solution #5
Fit all data points with polynomial

40
Solution #5

41
Solution #6
For the second order Lagrange interpolation the number of data
required = 3 Therefore choose only three data.

42
Solution #6

43
THE END!

44

You might also like