Why discrete transfer function show different result in Simulink but same result in Matlab?

10 次查看(过去 30 天)
I am getting different results in Matlab & Simulink when I try to simulate step response of a discrete spring mass damper transfer function. Here is my transfer function.
H=tf([1],[1 0.2 1]); %transfer function of a continuous system
Hd=c2d(H,0.01) %converting continuous system to a discrete system with sampling time of 0.01
Hd = 4.997e-05z +4.993e-05
-----------------------
z^2 - 1.998 z + 0.998
step(H,'-',Hd,'r--')
When I plot this in Matlab I get the same trajectory for both continuous and discrete system which is as expected .
Figure(1): Matlab result
The issue is when I try to do the same in Simulink, I get different result for the discrete system.
I made two changes to my Simulink settings in Model Configuration parameters:
1) I changed the solver selection from variable step to Fixed-Step
2) Fixed-Step size(Fundamental sample time) to 0.01. Everything else is kept as default
Figure(2): Simulink Model
-
Figure(3): Simulink Result
I don't understand what am I doing wrong in Simulink? I am expecting a trajectory similar to a continuous system
Thank you,

回答(3 个)

ONT
ONT 2020-5-12
Hello,
The cause of this issue is that the discrete transfer function you have in Discrete Transfer Function Simulink block is not the same as the one that MATLAB calculated with c2d function.
The coefficents of Hd(z) after using c2d function on H(s) are:
for Numerator
0 4.99662669945566e-05 4.99329671410653e-05
for Denominator
1 -1.99790209943320 0.998001998667333
In your Simulink Discrete Transfer Function you rounded up the coefficents and therfore changed the dynamic behaviour of system.
If you retype the coefficents from MATLAB to Simulink exactly as they are, the step responses will align in Simulink just like in MATLAB. Same if instead of hand-typing the coefficents into Transfer Function block, you will use LTI System Block and reference H and Hd LTI objects from MATLAB workspace.

Haritha
Haritha 2018-10-13
Hi,
Check the sampling time for all the blocks.

Steve Lee
Steve Lee 2019-3-14
I had a same problem, why it so different even I had checked carefully all sample times.

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by