coeb223 tutorial 5

2
Tutorial 5 – Regression and Interpolation 1. Use linear and quadratic regression to find the value of y(18). Find the value of correlation coefficient (r) in both cases. X 5 10 15 20 25 30 35 40 45 50 Y 17 24 31 33 37 37 40 40 42 41 Answer: Linear Regression – A = 20.6, B = 0.4945, y(18) = 29.501, r = 0.9157 Quadratic Regression – A = 11.7667, B = 1.3779, C = - 0.0161, y(18) = 31.3525, r = 0.9899 2. Bessel functions, J, are used extensively in engineering and are usually compiled in standard mathematical tables. For example: x 1.8 2 2.2 2.4 2.6 J(x) 0.5815 0.5767 0.556 0.5202 0.4708 Using linear OR quadratic regression, whichever is more accurate , find the value of J(2.1). Answer: Linear Regression - A = 0.8467, B = - 0.1390, r = -0.9532 Quadratic Regression – A = - 0.0398, B = 0.6806, C = - 0.1863, r = 0.9999 J(2.1) = 0.5679 3. Given the following data: x 2 3 4 5 y 5.1 7.6 10.4 12.0 a) Fit a straight line to the x and y values of the table using the linear regression method. Find the standard estimate of error, S y/x , the coefficient of determination, r 2 and the value of y when x = 3.5. Show all your workings. b) Redo the regression and force the intercept to zero. Recalculate the value of y when x = 3.5. (Hint: the linear best fit will be given by the equation y = ax). Answer: (a) A = 0.55, B = 2.35, S y/x = 0.3969, r 2 = 0.9887, y(3.5) = 8.775 (b) a = 2.4926, y(3.5) = 8.7241 4. Generate a Newton polynomial of order 3 and Lagrange polynomial of order 3 to approximate f(2.5) for the following data. Given that the true value is 0.86207, compute the true error in each case. x 1 2 3 4 5 f(x) 0.5 0.8 0.9 0.941176 0.96154 Answer: Newton Polynomial – f(2.5) = 0.8662, true error = 0.48% Lagrange Polynomial – f(2.5) = 0.8662, true error = 0.48%

Upload: sorna-kailash

Post on 15-Apr-2016

7 views

Category:

Documents


1 download

DESCRIPTION

COEB223 Tutorial 5

TRANSCRIPT

Page 1: COEB223 Tutorial 5

Tutorial 5 – Regression and Interpolation

1. Use linear and quadratic regression to find the value of y(18). Find the value of

correlation coefficient (r) in both cases.

X 5 10 15 20 25 30 35 40 45 50

Y 17 24 31 33 37 37 40 40 42 41

Answer: Linear Regression – A = 20.6, B = 0.4945, y(18) = 29.501, r = 0.9157

Quadratic Regression – A = 11.7667, B = 1.3779, C = - 0.0161, y(18) = 31.3525, r = 0.9899

2. Bessel functions, J, are used extensively in engineering and are usually compiled in

standard mathematical tables. For example:

x 1.8 2 2.2 2.4 2.6

J(x) 0.5815 0.5767 0.556 0.5202 0.4708

Using linear OR quadratic regression, whichever is more accurate, find the value of

J(2.1).

Answer: Linear Regression - A = 0.8467, B = - 0.1390, r = -0.9532

Quadratic Regression – A = - 0.0398, B = 0.6806, C = - 0.1863, r = 0.9999

J(2.1) = 0.5679

3. Given the following data:

x 2 3 4 5

y 5.1 7.6 10.4 12.0

a) Fit a straight line to the x and y values of the table using the linear regression

method. Find the standard estimate of error, Sy/x, the coefficient of

determination, r2 and the value of y when x = 3.5. Show all your workings.

b) Redo the regression and force the intercept to zero. Recalculate the value of y

when x = 3.5. (Hint: the linear best fit will be given by the equation y = ax).

Answer: (a) A = 0.55, B = 2.35, Sy/x = 0.3969, r2 = 0.9887, y(3.5) = 8.775

(b) a = 2.4926, y(3.5) = 8.7241

4. Generate a Newton polynomial of order 3 and Lagrange polynomial of order 3 to

approximate f(2.5) for the following data. Given that the true value is 0.86207,

compute the true error in each case.

x 1 2 3 4 5

f(x) 0.5 0.8 0.9 0.941176 0.96154

Answer: Newton Polynomial – f(2.5) = 0.8662, true error = 0.48%

Lagrange Polynomial – f(2.5) = 0.8662, true error = 0.48%

Page 2: COEB223 Tutorial 5

5. The following data were obtained from an experiment on the non-linearity effect of

Ohm’s Law:

i -2 -1 -0.5 0.5 1 2

V -637 -96.5 -20.5 20.5 96.5 637

From the last four points of the data, find the value of V(0.1) using a third order

Newton Polynomial . Answer: f(0.1) = 2.324

6. The followings are data of temperature vs. depth from a nuclear reactor.

Depth (m) 0.0 1.0 2.0 3.0

Temperature (oC) 70 55 13 10

Using a 3rd

order Lagrange Polynomial method,

a) Obtain an equation for temperature as a function of depth in the form of

T = Ad3+Bd

2+Cd+E where A, B, C and E are constant numbers.

b) Find the value of the temperature at depth of 2.5 m.

c) Find the depth where the temperature is 40 oC.

Answer: a) T = 11d3 – 46.5d2+20.5d+70, b) T(2.5) = 2.5 oC,

c) when T = 40 o

C , d = 1.3499m

7. As an engineering student, you are required to do an experiment which involves

measuring the electric current I at certain times t, by specifying different values of

voltage V across an inductor. The lab manual states that you should measure the

current six times, at t = 0, 0.125, 0.25, 0.3, 0.375 and 0.5. At the end of the lab session,

however, you realized that you only took five readings, as tabulated below:

Time, t (s) 0 0.125 0.25 0.375 0.5

Voltage, V (Volt) 0 2.5 3.2 2 0

Current, I (Ampere) 0 6 8 5 0

a. Use quadratic regression to calculate the current I at t = 0.3s and determine how

accurate is the result.

b. Given that V = 3 Volts at time t = 0.3s, apply the well-known Faraday’s Law,

V = L dtdI and the equation obtained from part (a) to find the inductance L (in

unit Henrys).

Answer: a) A = 0.1429, B = 60.9143, C = - 123.4286, I(0.3) = 7.3086, r = 0.9940

b) L = 0.2283 Henrys