Skip to content

Commit 97ace35

Browse files
committed
added automatic frequency computation to LTI.frequency_response
1 parent 13f3870 commit 97ace35

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎control/lti.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ def frequency_response(self, omega=None, squeeze=None):
7878
7979
Parameters
8080
----------
81-
omega : float or 1D array_like
81+
omega : float or 1D array_like, optional
8282
A list, tuple, array, or scalar value of frequencies in
83-
radians/sec at which the system will be evaluated.
83+
radians/sec at which the system will be evaluated. If None (default),
84+
a set of frequencies is computed based on the system dynamics.
8485
squeeze : bool, optional
8586
If squeeze=True, remove single-dimensional entries from the shape
8687
of the output even if the system is not SISO. If squeeze=False,
@@ -109,6 +110,11 @@ def frequency_response(self, omega=None, squeeze=None):
109110
"""
110111
from .frdata import FrequencyResponseData
111112

113+
if omega is None:
114+
# Use default frequency range
115+
from .freqplot import _default_frequency_range
116+
omega = _default_frequency_range(self)
117+
112118
omega = np.sort(np.array(omega, ndmin=1))
113119
if self.isdtime(strict=True):
114120
# Convert the frequency to discrete time

0 commit comments

Comments
 (0)