Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Wonsiri Punurai, PhD Department of Civil Engineering Room 6391, EG Building 3 Faculty of Engineering, Mahidol University Class Web: www.egmu.net/~civil/wonsiri
0 75
50
Experimental Data
Dial Gauge
Curve Fitting
{ { {
Linear Regression
Errors do exist between model and observation. Find the best line which minimizes the sum of error for all data
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.
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
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):
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
{ { {
Polynomial Regression
Model equation
0=
Normal Equations
Polyval Example
Error Bounds
Example