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

Commit49f03e7

Browse files
authored
Merge pull request#989 from murrayrm/update_rlocus_kvect-04Apr2024
Update documentation, processing of root_locus kvect keyword
2 parentsc638362 +1b59bd6 commit49f03e7

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

‎control/rlocus.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ def root_locus_map(sysdata, gains=None):
4242
"""Compute the root locus map for an LTI system.
4343
4444
Calculate the root locus by finding the roots of 1 + k * G(s) where G
45-
is a linear system with transfer function num(s)/den(s) and each k is
46-
an element of kvect.
45+
is a linear system and k varies over a range of gains.
4746
4847
Parameters
4948
----------
5049
sys : LTI system or list of LTI systems
5150
Linear input/output systems (SISO only, for now).
5251
gains : array_like, optional
53-
Gains to use in computing plot of closed-loop poles.
52+
Gains to use in computing plot of closed-loop poles. If not given,
53+
gains are chosen to include the main features of the root locus map.
5454
5555
Returns
5656
-------
@@ -98,20 +98,20 @@ def root_locus_map(sysdata, gains=None):
9898

9999

100100
defroot_locus_plot(
101-
sysdata,kvect=None,grid=None,plot=None,**kwargs):
101+
sysdata,gains=None,grid=None,plot=None,**kwargs):
102102

103103
"""Root locus plot.
104104
105105
Calculate the root locus by finding the roots of 1 + k * G(s) where G
106-
is a linear system with transfer function num(s)/den(s) and each k is
107-
an element of kvect.
106+
is a linear system and k varies over a range of gains.
108107
109108
Parameters
110109
----------
111110
sysdata : PoleZeroMap or LTI object or list
112111
Linear input/output systems (SISO only, for now).
113-
kvect : array_like, optional
114-
Gains to use in computing plot of closed-loop poles.
112+
gains : array_like, optional
113+
Gains to use in computing plot of closed-loop poles. If not given,
114+
gains are chosen to include the main features of the root locus map.
115115
xlim : tuple or list, optional
116116
Set limits of x axis, normally with tuple
117117
(see :doc:`matplotlib:api/axes_api`).
@@ -145,10 +145,9 @@ def root_locus_plot(
145145
* lines[idx, 2]: loci
146146
147147
roots, gains : ndarray
148-
(legacy) If the `plot` keyword is given, returns the
149-
closed-loop root locations, arranged such that each row
150-
corresponds to a gain in gains, and the array of gains (ame as
151-
kvect keyword argument if provided).
148+
(legacy) If the `plot` keyword is given, returns the closed-loop
149+
root locations, arranged such that each row corresponds to a gain,
150+
and the array of gains (same as `gains` keyword argument if provided).
152151
153152
Notes
154153
-----
@@ -160,13 +159,16 @@ def root_locus_plot(
160159
"""
161160
from .pzmapimportpole_zero_plot
162161

162+
# Legacy parameters
163+
gains=config._process_legacy_keyword(kwargs,'kvect','gains',gains)
164+
163165
# Set default parameters
164166
grid=config._get_param('rlocus','grid',grid,_rlocus_defaults)
165167

166168
ifisinstance(sysdata,list)andall(
167169
[isinstance(sys,LTI)forsysinsysdata])or \
168170
isinstance(sysdata,LTI):
169-
responses=root_locus_map(sysdata,gains=kvect)
171+
responses=root_locus_map(sysdata,gains=gains)
170172
else:
171173
responses=sysdata
172174

‎control/tests/rlocus_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ def test_root_locus_plots(sys, grid, xlim, ylim, interactive):
180180
# TODO: add tests to make sure everything "looks" OK
181181

182182

183+
# Test deprecated keywords
184+
deftest_root_locus_legacy():
185+
sys=ct.rss(2,1,1)
186+
withpytest.warns(DeprecationWarning,match="'kvect' is deprecated"):
187+
ct.root_locus_plot(sys,kvect=[0,1,2])
188+
189+
183190
# Generate plots used in documentation
184191
deftest_root_locus_documentation(savefigs=False):
185192
plt.figure()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp