Professional Documents
Culture Documents
Identification
Using MATLAB®
Mohsen Mirtalebi
I. Abstract:
Modeling in engineering is faced to the real world data analysis to achieve the
best mathematical model. The model that best fit into the given data is usually
named y_fitted. We used the same notation to identify the attempted model. This
report illustrates how we processed the given data to obtain the best y_fitted.
II. Introduction:
Our experiment has two parts. Part one of this report shows our attempt to find a
model for the given data in the file named Lab5_1.mat. There were three given
model to try out if it can fit into the given data. The following models were given:
1) y = a2 x2 + a1 x + a0 .
2) y = a.ebx.
3) y = x / (a + b.x).
The second part was to identify the model was best fitted for the given data in the
file named Lab5_2.mat. This information was processed and the model was
identified. The part two of this lab most likely a type of system identification
problem.
III. Equipment:
The only equipment we used was the laboratory’s computer including MatLab®
IV. Results:
The following information illustrates our attempts to find the appropriate model for
model:
X=[x.^2 x ones(length(x),1)];
Y=y;
A=inv(X'*X)*X'*Y;
Y_fitted=X*A;
e=Y-Y_fitted;
plot(x,Y_fitted,'b',x,y,'r.')
title('First Model');
xlabel('X');
ylabel('Y_fitted');
pause
plot(x,e,'r.')
title('Error');
xlabel('x');
ylabel('Y-Y_fitted');
pause
option=[1 0];
pt1='Histogram';
pt2=' ';
[xdata,ydata,xgauss,ygauss]=normal(e,option,pt1,pt2);
b. Plots for the first attempt:
This figure shows the found model vs. the given data distribution.
The histogram shows that the found model is not distributed normal.
B. Second attempt to find out that the given model can be fitted as a desired
model:
This figure shows the found model vs. the given data distribution.
Note that the given data is shown dotted.
Error diagram emphasizes on inappropriate found model
The histogram shows that the found model is not distributed normal.
C. Third attempt to find out that the given model can be fitted as a desired model:
x_i=[1./x ones(length(x),1)];
y_i=y;
y1=1./y_i;
P=inv(x_i'*x_i)*x_i'*y1;
a=P(1);
b=P(2);
e_transf=y1-x_i*P;
y_fitted=x./(a+b*x);
plot(x,y,'.',x,y_fitted,'r.');
pause;
e=y-y_fitted;
plot(x,e,'r.');
pause
plot(x,e_transf,'r.')
pause
option=[1 0];
pt1='Part 2';
pt2=' ';
[xdata,ydata,xgauss,ygauss]=normal(e,option,pt1,pt2);
This figure shows the found model vs. the given data distribution.
Note that the given data is shown dotted and almost matched with
the found model.
The error is distributed in a straight line that is the sign of minimum
The histogram shows that the found model is distributed normal and
can be used as an appropriate model.
The Following information is the result of process to identify the model for the given
This graph shows the discrete form of impulse response of the identified system.
V. Discussion:
The first part of the experiment was about finding the best model fitted into the
given data. After processing the data and finding constant coefficients we tried
three models. For the first and the second model we could not get a constant error
graph as well as a symmetric histogram these two graph beside the graph of the
attempted model vs. the real world data graph guided us to easily reject the first
two models. Similarly through the same process we could successfully verify and
confirm the third model because of an almost flat error graph and a symmetric
histogram.
The second part was performed through extracting constant coefficients from the
given data and plugs it in the difference equation to find the system transfer
function.
VI. Conclusion:
We think that the whole experiment was full of valuable information to be set as a
model line in the future to deal with the real world data.