Determine the output of the given Block diagram

3 views (last 30 days)
I have calculated by hand the output of the given block diagram Y(z), in Z-Domain. T=1 sec.
I get as result: Y(z)=4z/[3(z-1)^2]
I want to calculate the same result with matlab. Therefore I have written the following matlab script:
clear all
s = tf('s');
% model Gp(s)
Gp = 2/s;
H = s;
% close-loop transfer function in continuous domain
Tc = feedback(Gp,H);
% model Y(s)
Y = Tc*(2/s);
%% continuous to discrete transformation
T = 1; % sampling time 1 sec
Y_z = c2d(Y,T,'zoh')
But with matlab I receive as result:
Y_z = (0.6667 z + 0.6667)/(z^2 - 2 z + 1)
So my question is, is my matlab code wrong? Can I define with the matlab command c2d also the location where the sampler is placed?
Thank you!

Accepted Answer

Paul on 9 Oct 2021
Edited: Paul on 9 Oct 2021
Not clear how that Matlab code would mimic the by-hand solution without seeing the by-hand solution. But I really doubt that it does. Did your by-hand solution solve for the Y(s) by ignoring the sampler and then discretizing the result?
I solved the problem by hand and then evaluated it in Matlab and got the same result as your by-hand solution. If you post your by-hand solution we can probably figure out how to implement it in Matlab.
Mark S
Mark S on 10 Oct 2021
Edited: Mark S on 10 Oct 2021
"Excellent (but replace the 5 with an s!)." Yes you are right.
I got it now, thank you very much! It is not so easy to do this calculation with matlab. But now I have understood it.

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!