Effacer les filtres
Effacer les filtres

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

22 vues (au cours des 30 derniers jours)
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,

Réponses (3)

ONT
ONT le 12 Mai 2020
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 commentaire
Suyash Jadhav
Suyash Jadhav le 14 Jan 2022
Modifié(e) : Suyash Jadhav le 14 Jan 2022
This is the right solution for the issue. If you see your response rising, make sure the pole at denominator is <1.

Connectez-vous pour commenter.


Haritha
Haritha le 13 Oct 2018
Hi,
Check the sampling time for all the blocks.

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

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by