I am sorry for lack of explanation, I will explain in details what happened, and everyone is invited to tell me his conclusions.
first, I was preparing an experiment for students about basics of system identification, so I began with RC (low pass) passive circuit.
the resistance is 100k and the capacitance is 220 n. I made excitation input as pulses of 5 volts value and frequency of 10 hz. I made the sampling rate of data to be 0.005ms. I got the data between input and output that are in the attached file named "first order".
View attachment first order output.txt
View attachment first order input.txt
I used least square method in the following manner to estimate the parameters:
Code Verilog - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| function [Sysc,Hz]=identsys1(u,y,T)
z=%z;
s=%s
phi=[];
for i = 1:(length(u)-1)
phi = [phi ;y(i) u(i)];
end
Y=y(2:$);
theta= inv(phi'*phi)*phi'*Y
disp(theta)
Hz= theta(2)/(z - theta(1)) |
the rest of code was for making bilinear transformation to get the transfer function again to S domain.
when I used the above mentioned code, I got the estimation of : T.F = 68/(68+s)
and to test the estimated transfer function, I made the following validation in this attached photo:
the green curve is the actual response and the red curve is gotten from estimated transfer function. and as it seems it is a perfect estimation.
till now every thing is perfect, and working as it supposed to do.
I made another passive system, RLC, and the results was very good also, only I changed regressor equation (estimation equation) to fit with a second order system instead of first order .
the problems appeared when an opamp is part of the estimated system, even if the opamp is a buffer with nearly no effect at all on circuit performance.
for example, I made double RC circuit in the manner described as follows:
they are two RC low pass filter circuits, connected with buffering opamp.
the results that I got from estimation are weird and has no relation with the real system.
I recorded the values of input and output in the following attached files (the frequency of input was 10 hz square pulses and the and sampling period was 0.005)
View attachment second order overdamped output.txt
View attachment second order overdamped input.txt
actually, I began to suspect that opamp makes distortion in the signal so the estimated transfer function becomes wrong, so I plotted the signal before opamp and the signal after opamp to see if the opamp makes any effect. please look here:
as we see, no difference that can make wrong estimation.
That is why I got conclusion that existence of opamp makes the estimation process to be wrong, due to unknown reasons.
any suggestions to resolve this weird problem??