Z transfer fcn under simulink and cmd line

I create a simple cmd from S to Z domain as below, and the result is matched with my understanding;
clear
rth1=0.0268;
tau1=1066.6;
Ts=0.05;
tf1=tf(rth1,[tau1 1])
dtf1=c2d(tf1,Ts)
figure;
step(tf1);
figure
step(dtf1);
but when i create this under simulink, the result is not matched, as you can see the Z transfer fcn output is quite different with the S transfer fcn.
Is there anyone can help me?

2 Comments

Please attach you Simulink model and any scripts or other functions needed to run your example - thanks
Please see my answer below, I was able to work out what the issue was without your code, so no need to attach it now

Sign in to comment.

 Accepted Answer

This appears to be due to a round off error in the denominator of the discrete transfer function input to Simulink.
Try for example with the denominator set to
[1 -0.999949]
instead of
[1 -1]
and you will see that the step response of the continuous and discrete approximation are now much closer

5 Comments

with the denominator set to
[1 -0.999953]
they are right on top of each other
If in your MATLAB command window you change the formatting to long and look at the denominator of your dtf1 you will see something like this:
format long
>> dtf1.Denominator
ans =
1×1 cell array
{[1 -0.999953123168882]}
So in fact the pole is not at 1, which would make it an integrator as you saw in your Simulink but rather just inside the unit circle
The underlying issue here is that your sample time is very small 0.05s relative to the time constant of over 1066s for your continuous system, so you are greatly oversampling the system. This makes the last term in your denominator very close but not actually equal to -1
Thanks a lot, Jon. Your answer and explaination is quite clear, thanks again!
Your welcome, it was an interesting problem

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Asked:

on 5 Apr 2023

Commented:

Jon
on 6 Apr 2023

Community Treasure Hunt

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

Start Hunting!