5. Classical Methods of Control Theory

5.1 Root Loci

<< ControlSystems`

TransferFunction[s, ((s + 1)/(s^2))]

RootLocusPlot[%, {k, 0, 10}];

g = TransferFunction[s, (20/(s (s + 1) (s + 4)))]

h = TransferFunction[s, 1 + k s]

SeriesConnect[g, h]

\(\(RootLocusPlot[%, {k, 0, 2}, PlotPoints -> 20, 
        PoleStyle -> PointSize[ .005], 
        Epilog -> 
          Line[{{0, 
                0}, {\(-ζ\)\ ω, ω\ \@\(1 - ζ\^2\)} /. {ω -> 10, ζ ->  .4}}], 
        PlotLabel -> "Root Loci"];\)\)

kmax = 2; 
    points = 20; ((kmax )/(points - 1)) (# - 
              1) & /@ {5.2, 14.5}

results = 
      FeedbackConnect[g, h] /. List /@ Thread[k -> %] // 
        Simplify

SimulationPlot[#, UnitStep[t], {t, 5}, PlotRange -> All, 
            PlotLabel -> "Step Response"] & /@ 
        results;

5.2 The Bode Plot

5.2.1 The Basic Function

s2[ω_, ζ_] = 
        TransferFunction[
          s, ((ω^2)/((s^2) + 2 ζ ω s + (ω^2)))];

BodePlot[s2[1, 1]];

BodePlot[s2[1, 1], { .01, 100}];

TransferFunction[s, 
      Table[{(1/((s^2) + 2 s ζ + 1))}, {ζ,  .05,  .8,  .25}]]

BodePlot[%, { .1, 10}, 
        PlotStyle -> {Dashing[{ .05,  .01,  .01,  .01}], 
            Dashing[{ .05,  .01}], Dashing[{ .05}], Thickness[ .001]}, 
        PlotPoints -> 200];

\(\(ParametricPlot3D[
        Evaluate[{10\ Log[10, ω], ζ\ 50, 
            20\ Log[10, 
                Abs[\(\(s2[
                        1, ζ]\)[I\ ω]\)[[1, 1]]]]}], {ω,  .005, 
          5}, {ζ, 0, 1.5}, PlotPoints -> {40, 20}, 
        AxesLabel -> {"10 Log[10, ω]", "ζ×50", "Gain (dB)"}, Boxed -> False];\)\)

5.2.2 Gain and Phase Margins

g = 
      TransferFunction[
        s, ((k (s + 50))/(s (s + 10)))]

h = TransferFunction[s, (1/(s + 20))]

SeriesConnect[g, h]

BodePlot[% /. k -> 4. ];

BodePlot[%% /. k -> 4.  (10^(24/20)), 
        Margins -> True];

5.3 The Nyquist Plot

TransferFunction[s, (1/(((s + 1))^2))]

NyquistPlot[%];

TransferFunction[s, ((E^(-s))/(1 + s))]

NyquistPlot[%, { .01, 20}, PlotPoints -> 500];

5.4 The Nichols Plot

TransferFunction[
      s, (( .05 (10 s + 1) (s +  .005)  .9 2)/(s (s^2) (s + 2)))]

NicholsPlot[%];

5.5 The Singular-Value Plot

StateSpace[{{- .01, 0}, {0, - .02}}, {{1, 
          1}, {- .004,  .002}}, {{ .01, 0}, {0, 1}}]

SingularValuePlot[%];