Why discrete transfer function show different result in Simulink but same result in Matlab?
조회 수: 36 (최근 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,
댓글 수: 0
답변 (3개)
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.
댓글 수: 1
Suyash Jadhav
2022년 1월 14일
편집: Suyash Jadhav
2022년 1월 14일
This is the right solution for the issue. If you see your response rising, make sure the pole at denominator is <1.
Steve Lee
2019년 3월 14일
I had a same problem, why it so different even I had checked carefully all sample times.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 General Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!