Sie sind auf Seite 1von 46

# Advanced Mathematical Methods for Civil Engineering Applications

## Numerical techniques for interpolation & curve fitting

Wonsiri Punurai, PhD Department of Civil Engineering Room 6391, EG Building 3 Faculty of Engineering, Mahidol University Class Web: www.egmu.net/~civil/wonsiri

## Basic Problems in relation to CE work

25

0 75

50

Experimental Data

Dial Gauge

Curve Fitting
{ { {

## Linear Regression Polynomial Regression Multiple Linear Regression

Linear Regression

Errors do exist between model and observation. Find the best line which minimizes the sum of error for all data

{

## Linear Regression with MATLAB

{

Matlab function regress addresses the multiple linear regression problem based on the least squares approach. Matlab function regress estimates the model parameters and performing the regression model automatically. The regress function requires that the matrix of independent variables include a column of ones so that the model contains a constant term.

{

## Given the following independent observations for variable Q and t:

1 2 2 0 3 5.5 4 7.9 5 12 6 12.5 7 14 8 15 9 19 10 19.9

t Q

1 2

2 0

3 5.5

4 7.9

5 12

6 12.5

7 14

8 15

9 19

10 19.9

20 18 16 14 12 10 8 6 4 2 0 Q

5 t

10

## Figure 1: Plot of variable Q vs. t

Now one wants to check if there exists a linear relationship between Q and t (e.g. one wants to predict Q when t is 11 and 12 >> Use the regress function to estimate the model parameter and perform regression analysis. >>The regress function requires that the matrix of independent variables include a column of ones so that the model contains a constant term.

Create x in matlab

Now lets apply the regress function to our data (note that Q and t have to be transposed according to the function requirements):

## 95% CI for b1 95% CI for b2

Confidence intervals Default is 95% CI If contains zero, the constant shall be excluded.

Discussion

As a result, our model that can be used for prediction Q for given t look as follow

Q=2.0081t

25 Data Model 20

15 Q 10 5 0 1

5 t

10

Qt

Qt-1

Qt

Qt-1

Curve Fitting
{ { {

## Linear Regression Polynomial Regression Multiple Linear Regression

Polynomial Regression
Model equation

0=

Normal Equations

## Solving previous example using Matlab

Fit a 2nd order polynomial

Polyval Example

Error Bounds

Example