diff --git a/control/pzmap.py b/control/pzmap.py index 400db2807..f1d0ecae9 100644 --- a/control/pzmap.py +++ b/control/pzmap.py @@ -79,11 +79,13 @@ class PoleZeroData: System name. sys : StateSpace or TransferFunction System corresponding to the data. + sort_loci : bool, optional + Set to False to turn off sorting of loci into unique branches. """ def __init__( self, poles, zeros, gains=None, loci=None, dt=None, sysname=None, - sys=None): + sys=None, sort_loci=True): """Create a pole/zero map object. Parameters @@ -102,10 +104,14 @@ def __init__( System corresponding to the data. """ + from .rlocus import _RLSortRoots self.poles = poles self.zeros = zeros self.gains = gains - self.loci = loci + if loci is not None and sort_loci: + self.loci = _RLSortRoots(loci) + else: + self.loci = loci self.dt = dt self.sysname = sysname self.sys = sys @@ -187,7 +193,7 @@ def pole_zero_plot( ---------- data : List of PoleZeroData objects or LTI systems List of pole/zero response data objects generated by pzmap_response() - or rootlocus_response() that are to be plotted. If a list of systems + or root_locus_map() that are to be plotted. If a list of systems is given, the poles and zeros of those systems will be plotted. grid : bool or str, optional If `True` plot omega-damping grid, if `False` show imaginary axis diff --git a/control/rlocus.py b/control/rlocus.py index 54c672997..c14d1e315 100644 --- a/control/rlocus.py +++ b/control/rlocus.py @@ -88,7 +88,7 @@ def root_locus_map(sysdata, gains=None): root_array = _RLSortRoots(root_array) responses.append(PoleZeroData( - sys.poles(), sys.zeros(), kvect, root_array, + sys.poles(), sys.zeros(), kvect, root_array, sort_loci=False, dt=sys.dt, sysname=sys.name, sys=sys)) if isinstance(sysdata, (list, tuple)):