@@ -1216,16 +1216,29 @@ def dcgain(self, warn_infinite=False):
1216
1216
1217
1217
.. math: G(1) = C (I - A)^{-1} B + D
1218
1218
1219
+ Parameters
1220
+ ----------
1221
+ warn_infinite : bool, optional
1222
+ By default, don't issue a warning message if the zero-frequency
1223
+ gain is infinite. Setting `warn_infinite` to generate the warning
1224
+ message.
1225
+
1219
1226
Returns
1220
1227
-------
1221
- gain : ndarray
1222
- An array of shape (outputs,inputs); the array will either be the
1223
- zero-frequency (or DC) gain, or, if the frequency response is
1224
- singular, the array will be filled with (inf + nanj).
1225
-
1228
+ gain : (outputs, inputs) ndarray or scalar
1229
+ Array or scalar value for SISO systems, depending on
1230
+ config.defaults['control.squeeze_frequency_response'].
1231
+ The value of the array elements or the scalar is either the
1232
+ zero-frequency (or DC) gain, or `inf`, if the frequency response
1233
+ is singular.
1234
+
1235
+ For real valued systems, the empty imaginary part of the
1236
+ complex zero-frequency response is discarded and a real array or
1237
+ scalaris returned.
1226
1238
"""
1227
- return self (0 , warn_infinite = warn_infinite ) if self .isctime () \
1239
+ zeroresp = self (0 , warn_infinite = warn_infinite ) if self .isctime () \
1228
1240
else self (1 , warn_infinite = warn_infinite )
1241
+ return zeroresp .real if np .all (np .isreal (zeroresp )) else zeroresp
1229
1242
1230
1243
def _isstatic (self ):
1231
1244
"""True if and only if the system has no dynamics, that is,
0 commit comments