You are on page 1of 1

UNIVERSITY OF BAHRAIN

Civil Engineering Department

CENG 202 NUMERICAL ANALYSIS

CURVE FITTING

TUTORIAL 7

Q.1) x 2 3 4 7 8 9
y 9 6 5 10 9 11

a) Use least square regression to fit a straight line to the following data, plot the data and straight line
together.

b) Use polynomial regression to fit a parabola to the data and plot the data and fitted parabola together.
Then compare the results obtained at parts a and b.

Q.2) There tensile tests were carried out on an aluminum bar. In each test the strain was measured at the
same values of the stress. Use linear regression to estimate the modulus of elasticity of the bar (Modulus
of elasticity= stress/strain). Check your result with polyfit function of MATLAB.

Stress (MPa) 34.5 69.0 103.5 138.0


Strain (test1) 0.46 0.95 1.48 1.93
Strain (test2) 0.34 1.02 1.51 2.09
Strain (test3) 0.73 1.10 1.62 2.12

Q.3) Fit a straight line and quadratic (parabola) equations to given data? Which is better? Check your result
with polyfit function in MATLAB.

x 1 1.8 2.2 2.5 3.5 4


y 6.1 9.6 11.1 15.8 27.1 33.8

Q.4) Fit a power equation y  ax b to the following data. Plot y versus x along with power equation.

x 2.5 3.5 5 6 7.5 10 12.5 15 20


y 7 5.5 3.9 3.6 3.1 2.8 2.6 2.4 2.3

x x
Q.5) Determine a and b for which f ( x )  a sin( )  b cos( ) fits the following data in the least
2 2
squares sense.

x -0.5 -0.19 0.02 0.20 0.35 0.5


y -3.558 -2.874 -1.995 -1.040 -0.068 0.677

You might also like