### 1.27 Given a closed loop block diagram, generate the closed loop Z transform and check its stability

Problem: Given the following block diagram, with sampling time $$T=0.1\ sec$$, generate the closed loop transfer function, and that poles of the closed loop transfer function are inside the unit circle

System block diagram.

Mathematica

Remove["Global*"]
plant  = TransferFunctionModel[s/(1.0+s),s];
plantd = ToDiscreteTimeModel[
plant,
1,
z,
Method->"ZeroOrderHold"]



d = ToDiscreteTimeModel[
TransferFunctionModel[(s+1)/(s+5.0),s],
1,
z,
Method->"ZeroOrderHold"]



sys=SystemsModelSeriesConnect[d,plantd]



loopBack=SystemsModelFeedbackConnect[sys]



Now generate unit step response

ListPlot[OutputResponse[loopBack,
Table[1, {k, 0, 20}]],
Joined->True,
PlotRange->All,
InterpolationOrder->0,
Frame->True,
PlotStyle->{Thick,Red},
GridLines->Automatic,
GridLinesStyle->Dashed,
FrameLabel->{{"y(k)",None},
{"n","plant response"}},
RotateLabel->False]



ss=StateSpaceModel[loopBack]



poles=TransferFunctionPoles[loopBack]



${\begin {array}{c} \{0.543991\, -0.325556 i,0.543991\, +0.325556 i\} \\ \end {array}}$

Abs[#]&/@poles



$\left ( {\begin {array}{c} \{0.633966,0.633966\} \\ \end {array}} \right )$

Poles are inside the unit circle, hence stable.

Matlab

clear all; close all

s      = tf('s');
plant  = s/(s+1);
T      = 1; %sampeling time;
plantd = c2d(plant,T,'zoh');
d      = c2d( (s+1)/(s+5), T , 'zoh');
% obtain the open loop
sys    = series(d,plantd);
% obtain the closed loop
loop   = feedback(sys,1)


loop =

z^2 - 1.801 z + 0.8013
------------------------
2 z^2 - 2.176 z + 0.8038

Sample time: 1 seconds
Discrete-time transfer function.


step(loop)
grid



[z,p,k]=zpkdata(loop,'v');
fprintf('poles of closed loop discrete system as inside unit circle\n');
abs(p)


ans =
0.6340
0.6340

`