A feedback control system is simulated using a controller and a second-order plant. The controller operation can be proportional, proportional-integral, proportional-derivative, or proportional-integral-derivative. Mathematica
8 control system functions are used in all the computation.
To determine relative stability of the closed loop, the gain margin in db and phase margin in degrees of the open loop are shown above the Bode plots. For the case of multiple crossover frequencies, the highest frequency is used. The plant and closed-loop transfer functions are shown above the step response plot. For analysis of the absolute stability, the closed-loop poles' locations on the
-plane as well as their coordinates are displayed below the plot in the left side. The closed loop is unstable when the real part of any pole is positive. SI units are used throughout.
The plant transfer function is given by
is the DC gain,
is the damping ratio,
is the natural frequency,
is the Laplace transform of the output of the plant, and
is the Laplace transform of the input to the plant. The controller used in the parallel form is given by
are the proportional, derivative, and integral parameters, respectively. The open-loop transfer function is
and the closed-loop transfer function is
 J. J. D'Azzo and C. H. Houpis, Linear Control System Analysis & Design
, 3rd ed., New York: McGraw–Hill, 1988.
 R. C. Dorf and R. H. Bishop, Modern Control Systems
, 11th ed., Englewood Cliffs, NJ: Prentice–Hall, 2007.
 K. Ogata, System Dynamics
, 4th ed., Englewood Cliffs, NJ: Prentice–Hall, 2003.