@@ -81,11 +81,16 @@ def _poly_iw_sqr(pol_iw):
8181
8282def _poly_iw_real_crossing (num_iw , den_iw , epsw ):
8383 # Return w where imag(H(iw)) == 0
84+
85+ # Compute the imaginary part of H = (num.r + j num.i)/(den.r + j den.i)
8486 test_w = np .polysub (np .polymul (num_iw .imag , den_iw .real ),
8587 np .polymul (num_iw .real , den_iw .imag ))
88+
89+ # Find the real-valued w > 0 where imag(H(iw)) = 0
8690 w = np .roots (test_w )
8791 w = np .real (w [np .isreal (w )])
8892 w = w [w >= epsw ]
93+
8994 return w
9095
9196
@@ -471,7 +476,7 @@ def phase_crossover_frequencies(sys):
471476 omega : ndarray
472477 1d array of (non-negative) frequencies where Nyquist plot
473478 intersects the real axis
474- gain : ndarray
479+ gains : ndarray
475480 1d array of corresponding gains
476481
477482 Examples
@@ -493,13 +498,13 @@ def phase_crossover_frequencies(sys):
493498 omega = _poly_iw_real_crossing (num_iw , den_iw , 0. )
494499
495500 # using real() to avoid rounding errors and results like 1+0j
496- gain = np .real (evalfr ( sys , 1J * omega ))
501+ gains = np .real (sys ( omega * 1j , warn_infinite = False ))
497502 else :
498503 zargs = _poly_z_invz (sys )
499504 z , omega = _poly_z_real_crossing (* zargs , epsw = 0. )
500- gain = np .real (evalfr ( sys , z ))
505+ gains = np .real (sys ( z , warn_infinite = False ))
501506
502- return omega , gain
507+ return omega , gains
503508
504509
505510def margin (* args ):
0 commit comments