Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sort loci in PoleZeroData #1070

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

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 9 additions & 3 deletions control/pzmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion control/rlocus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand Down
Loading