My Simulink results of a delayed discrete transfer function differs from lsim output
2 次查看(过去 30 天)
显示 更早的评论
I am trying to simply simulate a model I obtained from the system identification toolbox. The model is a discrete model with an input delay. However, the results from simulating with the command 'lsim' is different from what I get from simulink. The output from 'lsim' is similar to what I expect to get but the results from the simulatiom is wrong. I am simulating the model both in MATLAB and SIMULINK with the input 'u' which is a two-column matrix with the first column for the simulation time and the second column for the corresponding input.
>> tf1=tf([0,5.1095],[1,-1.9924,0.9924],1,'IODelay',261)
tf1 =
5.109
z^(-261) * ----------------------
z^2 - 1.992 z + 0.9924
Sample time: 1 seconds
Discrete-time transfer function.
>> y_lsim=lsim(tf1,u(:,2),u(:,1));
>> out=sim('system_simulation.slx');
A view from the simulink file ''system_simulation.slx'' :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/597385/image.png)
Solver is fixed-step with 1s as the step time.
>> plot(out.tout,y,out.tout,y_lsim,'r--')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/597390/image.png)
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulation and Prediction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!