The discrete-time identified transfer function fits well with the data (Fit to estimation data: 97.9% , see also y_ym.jpg produced by System identification Apps). However, when I tried to test it with lsim as follows, I found y and yd are quite different (see y_yd.jpg), and yd is near zeros, why??
-------------- MATLAB code ------------------
data=iddata(y, u, Ts)
np = 5;
nz = 6;
sysd= tfest(data,np,nz,'Ts', data.Ts) % H(Z^-1)
[yd, ~]= lsim(sysd, u, t);
plot(t, y, t yd) % see y_yd.jpg
--------------outputs for sysd------------------
sysd =
0.05867 z^-1 - 0.07004 z^-2 - 0.3296 z^-3 + 0.8198 z^-4 - 0.664 z^-5 + 0.1851 z^-6
----------------------------------------------------------------------------------
1 - 4.302 z^-1 + 7.507 z^-2 - 6.645 z^-3 + 2.984 z^-4 - 0.5435 z^-5
Fit to estimation data: 97.9% (simulation focus)
FPE: 0.0001175, MSE: 0.0001155