-
Notifications
You must be signed in to change notification settings - Fork 438
discard zero imaginary part for sys.dcgain() #579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -448,7 +448,7 @@ def test_dcgain_consistency(): | |||
np.testing.assert_equal( | |||
sys_tf(0j, warn_infinite=False), complex(np.nan, np.nan)) | |||
np.testing.assert_equal( | |||
sys_tf.dcgain(warn_infinite=False), complex(np.nan, np.nan)) | |||
sys_tf.dcgain(warn_infinite=False), np.nan) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a test to show that dcgain() on a system with negative gain at zero frequency returns a negative number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already exists:
python-control/control/tests/freqresp_test.py
Lines 505 to 507 in 8c9e807
# Make sure that we get the *signed* DC gain | |
sys_tf = -1 / (s + 1) | |
np.testing.assert_almost_equal(sys_tf.dcgain(), -1) |
@@ -1070,12 +1070,19 @@ def dcgain(self, warn_infinite=False): | |||
|
|||
Returns | |||
------- | |||
gain : ndarray | |||
The zero-frequency gain | |||
gain : (outputs, inputs) ndarray or scalar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gain : (noutputs, ninputs) ndarray or scalar
zero-frequency (or DC) gain, or, if the frequency response is | ||
singular, the array will be filled with (inf + nanj). | ||
|
||
gain : (outputs, inputs) ndarray or scalar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gain : (noutputs, ninputs) ndarray or scalar
Closes #578