My Simulink results of a delayed discrete transfer function differs from lsim output

1 view (last 30 days)
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'' :
Solver is fixed-step with 1s as the step time.
>> plot(out.tout,y,out.tout,y_lsim,'r--')

Answers (0)

Categories

Find more on General Applications in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!