control.evalfr

control.evalfr(sys, x, squeeze=None)

Evaluate the transfer function of an LTI system for complex frequency x.

Returns the complex frequency response sys(x) where x is s for continuous-time systems and z for discrete-time systems, with m = sys.ninputs number of inputs and p = sys.noutputs number of outputs.

To evaluate at a frequency omega in radians per second, enter x = omega * 1j for continuous-time systems, or x = exp(1j * omega * dt) for discrete-time systems, or use freqresp(sys, omega).

Parameters
  • sys (StateSpace or TransferFunction) – Linear system

  • x (complex scalar or 1D array_like) – Complex frequency(s)

  • squeeze (bool, optional (default=True)) – If squeeze=True, remove single-dimensional entries from the shape of the output even if the system is not SISO. If squeeze=False, keep all indices (output, input and, if omega is array_like, frequency) even if the system is SISO. The default value can be set using config.defaults[‘control.squeeze_frequency_response’].

Returns

fresp – The frequency response of the system. If the system is SISO and squeeze is not True, the shape of the array matches the shape of omega. If the system is not SISO or squeeze is False, the first two dimensions of the array are indices for the output and input and the remaining dimensions match omega. If squeeze is True then single-dimensional axes are removed.

Return type

complex ndarray

See also

freqresp, bode

Notes

This function is a wrapper for StateSpace.__call__() and TransferFunction.__call__().

Examples

>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
>>> evalfr(sys, 1j)
array([[ 44.8-21.4j]])
>>> # This is the transfer function matrix evaluated at s = i.

Todo

Add example with MIMO system