Definitions

Generic definitions

Turn off annoying warnings messages

Off[General :: spell1] ; Off[General :: spell] ;

Load in necessary packages

<<Graphics`Colors` ;

Differential equation to characteristic equation

DiffEqToCharEq[eq_] := eq/. {Derivative[i_][x][t] s^i, x[t] 1} ;

Display DSolve output

DisplayDSolve[eqs_] := x == (x /. DSolve[eqs, x, t])[[1, 2]] // TraditionalForm

Process DSolve output

ProcessDSolve[eqs_] :=  (x /. Flatten[DSolve[eqs, x, t]])[[2]] // ExpandAll

Root locus plotting

One root locus for one root

OneRootLocusOneRoot[root_, const_, vary_, opts___] := Module[{tmp, fnc}, tmp = ... {Re[tmp], Im[tmp]}/.vary[[1]] vary[[3]]]}}], DisplayFunctionIdentity]] ] ;

Corresponding gain line

OneGainLineOneRoot[root_, const_, vary_, opts___] :=  {{opts, Line[{{const[[2]], vary[ ... Point[{const[[2]], vary[[2]]}]}, {Magenta, PointSize[.02], Point[{const[[2]], vary[[3]]}]}} // N ;

All root loci for one root

RootLociOneRoot[root_, v1_, v2_, opts___] := Table[OneRootLocusOneRoot[root, {v1[[1]], ... 3]]}, FrameTrue, DisplayFunctionIdentity, opts], {i, v1[[2]], v1[[3]], v1[[4]]}] ;

Corresponding gain lines

GainLinesOneRoot[root_, v1_, v2_, opts___] := Table[OneGainLineOneRoot[root, {v1[[1]], i}, {v2[[1]], v2[[2]], v2[[3]]}, opts], {i, v1[[2]], v1[[3]], v1[[4]]}] ;

Root loci for both roots

RootLoci[roots_, v1_, v2_, opts___] := Show[RootLociOneRoot[roots[[1]], v1, v2, PlotSt ... , PlotStyleGreen], AxesFalse, PlotLabel "Complex Plane", opts] ;

Corresponding gain lines

GainLines[roots_, v1_, v2_, opts___] := Show[Graphics[GainLinesOneRoot[roots[[1]], v1, ... ectRatioAutomatic, FrameTrue, PlotLabel->"Gain trajectories", opts] ;


Created by Mathematica  (November 12, 2003)