Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update documentation, processing of root_locus kvect keyword#989

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall 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
28 changes: 15 additions & 13 deletionscontrol/rlocus.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,15 +42,15 @@ def root_locus_map(sysdata, gains=None):
"""Compute the root locus map for an LTI system.

Calculate the root locus by finding the roots of 1 + k * G(s) where G
is a linear system with transfer function num(s)/den(s) and each k is
an element of kvect.
is a linear system and k varies over a range of gains.

Parameters
----------
sys : LTI system or list of LTI systems
Linear input/output systems (SISO only, for now).
gains : array_like, optional
Gains to use in computing plot of closed-loop poles.
Gains to use in computing plot of closed-loop poles. If not given,
gains are chosen to include the main features of the root locus map.

Returns
-------
Expand DownExpand Up@@ -98,20 +98,20 @@ def root_locus_map(sysdata, gains=None):


def root_locus_plot(
sysdata,kvect=None, grid=None, plot=None, **kwargs):
sysdata,gains=None, grid=None, plot=None, **kwargs):

"""Root locus plot.

Calculate the root locus by finding the roots of 1 + k * G(s) where G
is a linear system with transfer function num(s)/den(s) and each k is
an element of kvect.
is a linear system and k varies over a range of gains.

Parameters
----------
sysdata : PoleZeroMap or LTI object or list
Linear input/output systems (SISO only, for now).
kvect : array_like, optional
Gains to use in computing plot of closed-loop poles.
gains : array_like, optional
Gains to use in computing plot of closed-loop poles. If not given,
gains are chosen to include the main features of the root locus map.
xlim : tuple or list, optional
Set limits of x axis, normally with tuple
(see :doc:`matplotlib:api/axes_api`).
Expand DownExpand Up@@ -145,10 +145,9 @@ def root_locus_plot(
* lines[idx, 2]: loci

roots, gains : ndarray
(legacy) If the `plot` keyword is given, returns the
closed-loop root locations, arranged such that each row
corresponds to a gain in gains, and the array of gains (ame as
kvect keyword argument if provided).
(legacy) If the `plot` keyword is given, returns the closed-loop
root locations, arranged such that each row corresponds to a gain,
and the array of gains (same as `gains` keyword argument if provided).

Notes
-----
Expand All@@ -160,13 +159,16 @@ def root_locus_plot(
"""
from .pzmap import pole_zero_plot

# Legacy parameters
gains = config._process_legacy_keyword(kwargs, 'kvect', 'gains', gains)

# Set default parameters
grid = config._get_param('rlocus', 'grid', grid, _rlocus_defaults)

if isinstance(sysdata, list) and all(
[isinstance(sys, LTI) for sys in sysdata]) or \
isinstance(sysdata, LTI):
responses = root_locus_map(sysdata, gains=kvect)
responses = root_locus_map(sysdata, gains=gains)
else:
responses = sysdata

Expand Down
7 changes: 7 additions & 0 deletionscontrol/tests/rlocus_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,13 @@ def test_root_locus_plots(sys, grid, xlim, ylim, interactive):
# TODO: add tests to make sure everything "looks" OK


# Test deprecated keywords
def test_root_locus_legacy():
sys = ct.rss(2, 1, 1)
with pytest.warns(DeprecationWarning, match="'kvect' is deprecated"):
ct.root_locus_plot(sys, kvect=[0, 1, 2])


# Generate plots used in documentation
def test_root_locus_documentation(savefigs=False):
plt.figure()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp