Вы находитесь на странице: 1из 28

CURVE FITTING

INTRODUCTION
velocity (m/s) 10 20 30
Wind tunnel experiment to measure how the force of air resistance depends on velocity

Force (N) 25 70 380

Fu = cd v2 Fu = upward force of air resistance cd = drag coefficient v = velocity

40 50 60 70 80

550 610 1220 830 1450

INTRODUCTION
Experimental data for force and velocity from a wind tunnel experiment
2000
Force (N)

By visual inspection:

1500 1000 500 0 0 20 40 60 80 100 velocity (m/s)

Can you say something about the behavior of the data?

INTRODUCTION
Experimental data for force and velocity from a wind tunnel experiment
2000
Force (N)

By visual inspection: 1. The points indicate that the force increases as velocity increases 2. The points do not increase smoothly but exhibit significant scatter, particularly at high velocities.

1500 1000 500 0 0 20 40 60 80 100 velocity (m/s)

3. The relationship between force and velocity may not be linear. (v= 0 , F=0)

CURVE FITTING
It is a term use in finding a curve which has the best fit to series of data points and possibly other constraints.

CURVE FITTING
Two General Approaches for Curve Fitting 1. When the data exhibits a significant degree of error or scatter Strategy: derive a single curve that represents the general trend the data (eg : least square regression) 2. When the data is known to be very precise (eg density of water or specific heat of water as a function of temperature) Strategy : fit a curve or a series of curve that pass directly through each of points

Three attempts to fit a best curve through five data points

Least Square Regression

Linear Interpolation

Curvilinear interpolation

Linear Least Square Regression


When substantial error is associated with data , the best curve fitting strategy is to derive an approximating function that fits the shape or general trend of the data without necessarily matching the individual points. One way to do this is to derive the curve that minimizes the sum of the squares of the discrepancy between the data points and the curve. This technique is called least square regression .

Linear Least Square Regression


The simplest example of a least squares approximation is fitting a straight line to a set of paired observation: (x1, y1), (x2, y2), (x3, y3), ..., (xn, yn). The mathematical equation for a straight line is: y = ao + a 1 x + e
a0 and a1 are cefficients representing the intercept and the slope

e is error or residual. It is the discrepancy between the true value of y and the approximate value ao + a1x , predicted by linear equation.

Least Square Fit of a Straight Line


ei = yi ao a1 x1 Sr = ei2= yi ao a1 x12
To determine the values of ao and a1, the equation above is differentiated with respect to each unknown coefficient Sr = -2 (yi ao a1 x1) ao Sr = -2 (yi ao a1 x1) a1

Least Square Fit of a Straight Line


0 = yi ao a1 x1 0 = x1 yi ao x1 a1 x12 ao = nao nao + ( x1 ) a1 = yi ( x1 ) a0 + ( x12) a1 = x1 yi

Least Square Fit of a Straight Line


Formulas: a1 = n xi yi - xi yi
n xi2 ( xi)
2

ao = ymean - a1 xmean y = a0 + a 1 x

Problem1: Linear Regression


Fit a straight line to the values listed in the table shown :
velocity (m/s) 10 20 30 Force (N) 25 70 380

40 50 60 70 80

550 610 1220 830 1450

Problem1: Linear Regression


i 1 2 3 4 5 6 7 8 Summation xi 10 20 30 40 50 60 ? ? ? yi 25 70 380 550 610 1220 ? ? ? xi ^2 100 400 900 1600 2500 3600 ? ? ? xiyi 250 1400 11400 22000 30500 73200 ? ? ?

Problem1: Linear Regression


i 1 2 3 4 5 6 7 8 Summation xi 10 20 30 40 50 60 70 80 360 yi 25 70 380 550 610 1220 830 1450 5135 xi ^2 100 400 900 1600 2500 3600 4900 6400 20400 xiyi 250 1400 11400 22000 30500 73200 58100 116000 312850

Problem1: Linear Regression


Xmean = 360 /8 = 45 ymean = 5135 /8 = 641. 875

a1 = 8 ( 312,850) 360 (5,135) = 19.47024 8 (20,400) (3602) a0 = 641.875 - 19.47024 (45) = -234.2857
F = -234.2857 + 19.47024v

Correlation Coefficient, r
r= n xi yi - ( xi )( y i)_______ [(n xi2 ( xi )2] [(n yi2 ( y1 )2]

Estimation of error for the linear least square fit

Linearization of Non linear Relationships


Linear Regression provides a powerful technique for fitting a best line to data. However, it is predicated on the fact that the relationship between the dependent and independent variables is linear. Transformation can be used to express the data in a form that is compatible with linear regression

Linearization of Non linear Relationships


Exponential model: y = e Linearization : ?
x

Simple power Equation: y = x Linearization : ?

Saturation Growth Rate Equation : y = Linearization : ?

x +x

Linearization of Non linear Relationships


Exponential model: y = e x Linearization : ln y = ln + x Simple power Equation: y = x Linearization : log y = log + log x Saturation Growth Rate Equation : y = Linearization : x +x 1/y = 1/ + / (1 /x)

Problem 2 : Fitting data with the power equation


Fit the power equation to the data in Problem 1 using a logarithmic transformation of the data
velocity (m/s) 10 20 30 40 Force (N) 25 70 380 550

50 60 70 80

610 1220 830 1450

Problem 2 : Fitting data with the power equation


Simple power Equation: y = x Linearization : log y = log + log x
i 1 2 xi 10 20 yi 25 70 log xi 1.00000 1.30103 log yi 1.39794 1.84510 (log xi)^2 1.00000 1.69268 (log xi ) ( log yi) 1.39794 2.40053

3
4 5 6 7 8 Summation

30
40 50 60 70 80 360

380
550 610 1220 830 1450 5135

1.47712
1.60206 1.69897 ? ? ? ?

2.57978
2.74036 2.78533 ? ? ? ?

2.18189
2.56660 2.88650 ? ? ? ?

3.81065
4.39023 4.73219 ? ? ? ?

Problem 2 : Fitting data with the power equation


i 1 2 xi 10 20 yi 25 70 log xi 1.00000 1.30103 log yi 1.39794 1.84510 (log xi)^2 1.00000 1.69268 (log xi )( log yi) 1.39794 2.40053

3 4
5 6 7 8 Summation

30 40
50 60 70 80 360

380 550
610 1220 830 1450 5135

1.47712 1.60206
1.69897 1.77815 1.84510 1.90309 12.60552

2.57978 2.74036
2.78533 3.08636 2.91908 3.16137 20.51532

2.18189 2.56660
2.88650 3.16182 3.40439 3.62175 20.51562

3.81065 4.39023
4.73219 5.48801 5.38599 6.01637 33.62191

Problem 2 : Fitting data with the power equation


a1 = n x1 yi - x1 y1
n x12 ( x1)
2

SOLVE FOR : xmean = ? ymean = ? a1 = ? ao = ?

ao = ymean - a1 xmean

y = a0 + a1 x

Problem 2 : Fitting data with the power equation


xmean = 12.606 / 8 y mean = 20.515 / 8 a1 = 8 (33.622) 12.606 ( 20.515 ) = 1.9842 8 (20.516) - ( 12.606)2 a0 = 2.5644 1.9842 (1.5757) = -0.5620

Problem 2 : Fitting data with the power equation


The Least Square Fit : log y = - 0.5620 + 1.9842 log x F = 0.2741 v
1.9842

Least squares fit of a Power Model


Experimental data for force and velocity from a wind tunnel experiment
2000
Force (N)

Experimental data for force and velocity from a wind tunnel experiment
2500 2000 1500 1000 500

1500
Force (N)

1000 500 0 -500 0 20 40 60 80 100

0 0 20 40 60 80 100 velocity (m/s)

velocity (m/s)

Вам также может понравиться