@@ -113,7 +113,7 @@ def root_locus(sys, kvect=None, xlim=None, ylim=None, plotstr='-', Plot=True,
113113
114114 # plot open loop zeros
115115 zeros = array (nump .r )
116- if zeros .any () :
116+ if zeros .size > 0 :
117117 ax .plot (real (zeros ), imag (zeros ), 'o' )
118118
119119 # Now plot the loci
@@ -148,6 +148,9 @@ def _default_gains(num, den, xlim, ylim):
148148 mymat_xl = np .append (mymat , open_loop_zeros_xl )
149149 else :
150150 mymat_xl = mymat
151+ singular_points = np .concatenate ((num .roots , den .roots ), axis = 0 )
152+ important_points = np .concatenate ((singular_points , real_break ), axis = 0 )
153+ mymat_xl = np .append (mymat_xl , important_points )
151154
152155 if xlim is None :
153156 x_tolerance = 0.05 * (np .max (np .max (np .real (mymat_xl ))) - np .min (np .min (np .real (mymat_xl ))))
@@ -223,11 +226,11 @@ def _k_max(num, den, real_break_points, k_break_points):
223226 farthest_points = asymp_center + distance_max * np .exp (asymp_angles * 1j ) # farthest points over asymptotes
224227 kmax_asymp = - den (farthest_points ) / num (farthest_points )
225228 else :
226- farthest_points = 2 * np .max (np .abs (important_points ))
227- kmax_asymp = [- den (farthest_points ) / num (farthest_points )]
228- if np .max (kmax_asymp ) == 0 :
229229 kmax_asymp = [den .coeffs [0 ] / num .coeffs [0 ] * 3 ]
230- kmax = np .max (np .concatenate ((np .real (kmax_asymp ), k_break_points ), axis = 0 ))
230+ if np .max (kmax_asymp ) == 0 :
231+ kmax = np .max (np .concatenate ((np .real (kmax_asymp ), k_break_points ), axis = 0 ))
232+ else :
233+ kmax = kmax_asymp
231234 return kmax
232235
233236
0 commit comments