### 1.33 Draw root locus for a discrete system

Problem: Given the open loop for a continuous time system as $sys=\frac {5s+1}{s^{2}+2s+3}$

convert to discrete time using a sampling rate $$0.5$$ second, and display the root locus for the discrete system.

Mathematica

 Remove["Global`*"]; sys=TransferFunctionModel[ k(5s+1)/(s^2+2s+3),s]; samplePeriod=0.5; (*sec*) sysd=ToDiscreteTimeModel[sys,samplePeriod,z] p1 = RootLocusPlot[sysd,{k,0,100}, ImageSize->300, GridLines->Automatic, GridLinesStyle->Dashed, Frame->True, AspectRatio->1, PlotPoints->200, PlotStyle->PointSize[0.01]]; p2=ParametricPlot[{Sin[t],Cos[t]},{t,0,2Pi}, AspectRatio->1, GridLines->Automatic, GridLinesStyle->Dashed]; Show[p2,p1]

Matlab

 clear all; close all; s = tf('s'); sys = (5*s+1)/(s^2+2*s+3); Ts = 0.5; %sample time sysd = c2d(sys,Ts,'zoh'); rlocus(sysd) grid

Maple

 restart; alias(DS=DynamicSystems): sys := DS:-TransferFunction((5*s+1)/(s^2+2*s+3)); T :=1/2; #will fail if 0.5 is used !! sys := DS:-ToDiscrete(sys, T, 'method'='zoh'); DS:-RootLocusPlot(sys,-1..1,gridlines);