c2d function 'zoh' method formula

237 views (last 30 days)
Tamas Toth-K
Tamas Toth-K on 4 Oct 2020
Commented: Tamas Toth-K on 7 Oct 2020
Hi!
My following question would be, say i have a continuous time PI controller:
and i apply the function c2d(,,'zoh'), then it appears that matlab uses he substitution:
.
Which is completly fine, however if i have a transfer function like:
then when applying the c2d function c2d(,,'zoh'), it appears that the previous substitution in this case changes (s!=(z-1)/Ts)depending on the value of . I would like to know why Matlab does this, and what is its algebraic formula if possible?
Thank you!

Accepted Answer

Paul
Paul on 4 Oct 2020
I suspect that in your first case for C the substitution you cite is only applicable because of the form of C. In general, the ZOH approximation does not use that substitution. Though probably not implemented this way, the genaral form for the ZOH approximation can be implemented as shown below, and compared to what Matlab produces
P=5;Ti=6;Ts=.1; % example data
C=tf(P*[Ti 1],[Ti 0]);
Cz=c2d(C,Ts,'zoh');
Cznew = minreal(c2d(C*tf(1,[1 0]),Ts,'impulse')*tf([1 -1],[1 0],Ts)/Ts);
[Cz Cznew]
ans =
From input 1 to output:
5 z - 4.917
-----------
z - 1
From input 2 to output:
5 z - 4.917
-----------
z - 1
Sample time: 0.1 seconds
Discrete-time transfer function.
R=10;Te = 5; W=tf(1,[R*Te 1]);
Wz=c2d(W,Ts,'zoh');
Wznew = minreal(c2d(W*tf(1,[1 0]),Ts,'impulse')*tf([1 -1],[1 0],Ts)/Ts);
[Wz Wznew]
ans =
From input 1 to output:
0.001998
---------
z - 0.998
From input 2 to output:
0.001998
---------
z - 0.998
Sample time: 0.1 seconds
Discrete-time transfer function.
Th substitution you cite, s = (z -1)/Ts, the forward rectangular rule, which appears to be an allowable, albeit undocumented, method input to c2d.
  4 Comments
Tamas Toth-K
Tamas Toth-K on 7 Oct 2020
Thank you, very much! after you said it is he same I took another look and realized that out of the many substituted variables one was incorrect, after the fix it is the same :)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!