control.FrequencyResponseData¶
- class control.FrequencyResponseData(d, w[, smooth])¶
Bases:
control.lti.LTI
A class for models defined by frequency response data (FRD).
The FrequencyResponseData (FRD) class is used to represent systems in frequency response data form.
- Parameters
d (1D or 3D complex array_like) – The frequency response at each frequency point. If 1D, the system is assumed to be SISO. If 3D, the system is MIMO, with the first dimension corresponding to the output index of the FRD, the second dimension corresponding to the input index, and the 3rd dimension corresponding to the frequency points in omega
w (iterable of real frequencies) – List of frequency points for which data are available.
smooth (bool, optional) – If
True
, create an interpolation function that allows the frequency response to be computed at any frequency within the range of frequencies give inw
. IfFalse
(default), frequency response can only be obtained at the frequencies specified inw
.
- ninputs, noutputs
Number of input and output variables.
- Type
int
- omega¶
Frequency points of the response.
- Type
1D array
- fresp¶
Frequency response, indexed by output index, input index, and frequency point.
- Type
3D array
Notes
The main data members are ‘omega’ and ‘fresp’, where ‘omega’ is a 1D array of frequency points and and ‘fresp’ is a 3D array of frequency responses, with the first dimension corresponding to the output index of the FRD, the second dimension corresponding to the input index, and the 3rd dimension corresponding to the frequency points in omega. For example,
>>> frdata[2,5,:] = numpy.array([1., 0.8-0.2j, 0.2-0.8j])
means that the frequency response from the 6th input to the 3rd output at the frequencies defined in omega is set to the array above, i.e. the rows represent the outputs and the columns represent the inputs.
A frequency response data object is callable and returns the value of the transfer function evaluated at a point in the complex plane (must be on the imaginary access). See
__call__()
for a more detailed description.Methods
Natural frequency, damping ratio of system poles
Return the zero-frequency gain
Evaluate a transfer function at angular frequency omega.
Feedback interconnection between two FRD objects.
(deprecated) Evaluate transfer function at complex frequencies.
Evaluate the linear time-invariant system at an array of angular frequencies.
Check to see if a system is a continuous-time system
Check to see if a system is a discrete-time system
Check to see if a system is single input, single output
- __add__(other)¶
Add two LTI objects (parallel connection).
- __call__(s, squeeze=None)¶
Evaluate system’s transfer function at complex frequencies.
Returns the complex frequency response sys(s) of system sys 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
s = omega * 1j
or usesys.eval(omega)
For a frequency response data object, the argument must be an imaginary number (since only the frequency response is defined).
- Parameters
s (complex scalar or 1D array_like) – Complex frequencies
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
- Raises
ValueError – If s is not purely imaginary, because
FrequencyDomainData
systems are only defined at imaginary frequency values.
- __mul__(other)¶
Multiply two LTI objects (serial connection).
- __neg__()¶
Negate a transfer function.
- __radd__(other)¶
Right add two LTI objects (parallel connection).
- __rmul__(other)¶
Right Multiply two LTI objects (serial connection).
- __rsub__(other)¶
Right subtract two LTI objects.
- __rtruediv__(other)¶
Right divide two LTI objects.
- __sub__(other)¶
Subtract two LTI objects.
- __truediv__(other)¶
Divide two LTI objects.
- damp()¶
Natural frequency, damping ratio of system poles
- Returns
wn (array) – Natural frequencies for each system pole
zeta (array) – Damping ratio for each system pole
poles (array) – Array of system poles
- dcgain()¶
Return the zero-frequency gain
- eval(omega, squeeze=None)¶
Evaluate a transfer function at angular frequency omega.
Note that a “normal” FRD only returns values for which there is an entry in the omega vector. An interpolating FRD can return intermediate values.
- Parameters
omega (float or 1D array_like) – Frequencies in radians per second
squeeze (bool, optional) – 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
- feedback(other=1, sign=- 1)¶
Feedback interconnection between two FRD objects.
- freqresp(omega)¶
(deprecated) Evaluate transfer function at complex frequencies.
- frequency_response(omega, squeeze=None)¶
Evaluate the linear time-invariant system at an array of angular frequencies.
Reports the frequency response of the system,
G(j*omega) = mag*exp(j*phase)
for continuous time systems. For discrete time systems, the response is evaluated around the unit circle such that
G(exp(j*omega*dt)) = mag*exp(j*phase).
In general the system may be multiple input, multiple output (MIMO), where m = self.ninputs number of inputs and p = self.noutputs number of outputs.
- Parameters
omega (float or 1D array_like) – A list, tuple, array, or scalar value of frequencies in radians/sec at which the system will be evaluated.
squeeze (bool, optional) – 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
mag (ndarray) – The magnitude (absolute value, not dB or log10) of the system frequency response. If the system is SISO and squeeze is not True, the array is 1D, indexed by frequency. If the system is not SISO or squeeze is False, the array is 3D, indexed by the output, input, and frequency. If
squeeze
is True then single-dimensional axes are removed.phase (ndarray) – The wrapped phase in radians of the system frequency response.
omega (ndarray) – The (sorted) frequencies at which the response was evaluated.
- property inputs¶
Deprecated attribute; use
ninputs
instead.The
input
attribute was used to store the number of system inputs. It is no longer used. If you need access to the number of inputs for an LTI system, useninputs
.
- isctime(strict=False)¶
Check to see if a system is a continuous-time system
- Parameters
sys (LTI system) – System to be checked
strict (bool, optional) – If strict is True, make sure that timebase is not None. Default is False.
- isdtime(strict=False)¶
Check to see if a system is a discrete-time system
- Parameters
strict (bool, optional) – If strict is True, make sure that timebase is not None. Default is False.
- issiso()¶
Check to see if a system is single input, single output
- ninputs¶
Number of system inputs.
- noutputs¶
Number of system outputs.