The Control Package

(Author: Wilhelm Haager)

Reading the Package "Control"

<<control.m

Example Transfer Functions

s is assumed to be the Laplace variable, a is an arbitrary parameter.

Fs = 1/(s^2 + a s + 1)

F1 = ((Fs/.a->0.1)+(Fs/.a->1))/(Fs/.a->2)

Poles and Zeros

Poles[F1]

Zeros[F1]

(Inverse) Laplace Transform

LT is a convenient form of the Laplace Transform with t assumed to be the time variable and s assumed to be the Laplace Variable.  ILT and NILT calculate the inverse Laplace Transform.

F1t = ILT[F1]

Chop[LT[F1t] - F1 // Simplify]

Step Responses

The first argument is a transfer function or a list of transfer functions, the second argument is the displayed time interval.  Additional options are passed to the function Plot.

StepResponse[Table[Fs, {a, 0.1, 1, 0.1}], 10]

Bode Diagrams

The first argument is a transfer function or a list of transfer functions, of which the frequency response is to be plotted.  The option LogRange defines the logarithmic limits for the angular frequency.  Further options are passed to the function Plot.

Magnitude Plot:

BodePlot[Table[Fs, {a, 0.1, 1, 0.1}], PlotRange->{-2,1}]

Phase Plot:

BodePlotArg[Table[Fs,{a, 0.1, 1, 0.1}], PlotRange->{-180,0}]

Nyquist Diagrams

The argument is a transfer function or a list of transfer functions, of which the frequency response is to be plotted.  The logarithmic range for the angular frequency can be given with the option LogRange.  Further options are passed to the function ParametricPlot.

NyquistPlot[Table[Fs, {a, 0.1, 1, 0.1}],
	AspectRatio->Automatic, Axes->True, GridLines->Automatic]

Root Locus Plots

Let Fo be an open-loop transfer function with the amplification k:

Fo = k Fs/s /. a->3

The closed-loop transfer function Fw becomes:

Fw = Fo/(1 + Fo) // Simplify

The first argument of RootLocus is the transfer function, the second argument is the varying parameter.  The option of LinRange or LogRange gives the linear or logarithmic range for the parameter, the option Points gives the number of calculated points, the option EndMarks determines whether the beginning and ends of the curves shall be marked.  Additional options are passed to the function Graphics.

RootLocus[Fw, k, PlotRange->{{-4,2},{-3,3}}, GridLines->Automatic]

Contrary to common root locus programs the varying parameter need not be the open-loop amplification, but can be any arbitrary parameter:

RootLocus[Fs, a, LinRange->{0,3}, Points->100]