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

return frequency response for 0 and 1-state systems directly#663

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
bnavigator merged 2 commits intopython-control:masterfrombnavigator:fast-freqresp
Nov 3, 2021
Merged
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
24 changes: 19 additions & 5 deletionscontrol/statesp.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -851,7 +851,7 @@ def slycot_laub(self, x):
# transformed state matrices, at, bt, ct.

# Start at the second frequency, already have the first.
for kk, x_kk in enumerate(x_arr[1:len(x_arr)]):
for kk, x_kk in enumerate(x_arr[1:]):
result = tb05ad(n, m, p, x_kk, at, bt, ct, job='NH')
# When job='NH', result = (g_i, hinvb, info)

Expand DownExpand Up@@ -885,15 +885,29 @@ def horner(self, x, warn_infinite=True):
Attempts to use Laub's method from Slycot library, with a
fall-back to python code.
"""
# Make sure the argument is a 1D array of complex numbers
x_arr = np.atleast_1d(x).astype(complex, copy=False)

# return fast on systems with 0 or 1 state
if not config.defaults['statesp.use_numpy_matrix']:
if self.nstates == 0:
return self.D[:, :, np.newaxis] \
* np.ones_like(x_arr, dtype=complex)
if self.nstates == 1:
with np.errstate(divide='ignore', invalid='ignore'):
out = self.C[:, :, np.newaxis] \
/ (x_arr - self.A[0, 0]) \
* self.B[:, :, np.newaxis] \
+ self.D[:, :, np.newaxis]
out[np.isnan(out)] = complex(np.inf, np.nan)
return out

try:
out = self.slycot_laub(x)
out = self.slycot_laub(x_arr)
except (ImportError, Exception):
# Fall back because either Slycot unavailable or cannot handle
# certain cases.

# Make sure the argument is a 1D array of complex numbers
x_arr = np.atleast_1d(x).astype(complex, copy=False)

# Make sure that we are operating on a simple list
if len(x_arr.shape) > 1:
raise ValueError("input list must be 1D")
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp