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

Discrete to continuous#888

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

Open
kletze wants to merge2 commits intopython-control:main
base:main
Choose a base branch
Loading
fromkletze:discrete_to_continuous
Open
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
38 changes: 38 additions & 0 deletionscontrol/statesp.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1988,3 +1988,41 @@ def linfnorm(sys, tol=1e-10):
fpeak /= sys.dt

return gpeak, fpeak

def discrete2cont(sys, method='zoh'):
""" Transform a discrete state-space system to a continuous state-space system.
Parameters
------
sys : Discrete LTI (StateSpace or TransferFunction) system to transform
method: The method that was used for discretization

Returns
------
sysc : Continuous LIT (StateSpace or TransferFunction) system depending on the input form.
"""
# check if system is of type state space and convert if not
#if sys.

if not(isinstance(sys, StateSpace)):
sys = convert_to_statespace(sys)
was_tf = true
if method == 'zoh':
Ac = scipy.linalg.logm(sys.A)/sys.dt
Bc = np.linalg.inv(np.linalg.inv(Ac)@(sys.A-np.eye(np.shape(sys.A)[0])))@sys.B

# remove small numbers
Ac = np.around(Ac/1e-6)*1e-6
Bc = np.around(Bc/1e-6)*1e-6

# turn -0 to 0
Ac[np.abs(Ac)<1e-6] = 0
Bc[np.abs(Bc)<1e-6] = 0

sysc = StateSpace(Ac,Bc,sys.C,sys.D,0)
else:
raise NotImplementedError("Method: " + method + " is not implemented in this function!")

if was_tf:
sysc = ss2tf(sysc)

return sysc

[8]ページ先頭

©2009-2025 Movatter.jp