Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add zeros to vector of roots when calculation of axis limits it is pr…
…eformed.
  • Loading branch information
gonmolina committed Feb 19, 2017
commit 03df169d6f9f0de4e9eac2781080d5e3274c9892
14 changes: 10 additions & 4 deletions control/rlocus.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,24 @@ def _default_gains(num, den, xlim, ylim):
mymat = _find_roots(num, den, gvec)
mymat = _sort_roots(mymat)
# set smoothing tolerance
if (olzer.size != 0) and (olzer.size < olpol.size):
olzer_xl = np.append(olzer, np.ones(olpol.size - olzer.size) * olzer[-1])
mymat_xl = np.append(mymat, olzer_xl)
else:
mymat_xl = mymat

if xlim is None:
smtolx = 0.01 * (np.max(np.max(np.real(mymat))) - np.min(np.min(np.real(mymat))))
smtolx = 0.01 * (np.max(np.max(np.real(mymat_xl))) - np.min(np.min(np.real(mymat_xl))))
else:
smtolx = 0.01 * (xlim[1] - xlim[0])
if ylim is None:
smtoly = 0.01 * (np.max(np.max(np.imag(mymat))) - np.min(np.min(np.imag(mymat))))
smtoly = 0.01 * (np.max(np.max(np.imag(mymat_xl))) - np.min(np.min(np.imag(mymat_xl))))
else:
smtoly = 0.01 * (ylim[1] - ylim[0])

smtol = np.max(np.real([smtolx, smtoly]))
xl = _ax_lim(mymat)
yl = _ax_lim(mymat * 1j)
xl = _ax_lim(mymat_xl)
yl = _ax_lim(mymat_xl * 1j)

while ~done & (ngain < 1000):
done = True
Expand Down