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

Commita09e98c

Browse files
committed
move warning to before conversion
1 parentfa58099 commita09e98c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎control/timeresp.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
302302
"return_x specified for a transfer function system. Internal "
303303
"conversion to state space used; results may meaningless.")
304304

305+
# If we are passed a transfer function and X0 is non-zero, warn the user
306+
ifisinstance(sys,TransferFunction)andnp.any(X0!=0):
307+
warnings.warn(
308+
"Non-zero initial condition given for transfer function system. "
309+
"Internal conversion to state space used; may not be consistent "
310+
"with given X0.")
311+
305312
sys=_convert_to_statespace(sys)
306313
A,B,C,D=np.asarray(sys.A),np.asarray(sys.B),np.asarray(sys.C), \
307314
np.asarray(sys.D)
@@ -358,12 +365,6 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
358365
X0=_check_convert_array(X0, [(n_states,), (n_states,1)],
359366
'Parameter ``X0``: ',squeeze=True)
360367

361-
# If we are passed a transfer function and X0 is non-zero, warn the user
362-
ifisinstance(sys,TransferFunction)andnp.any(X0!=0):
363-
warnings.warn(
364-
"Non-zero initial condition given for transfer function system. "
365-
"Internal conversion to state space used; may not be consistent "
366-
"with given X0.")
367368

368369
xout=np.zeros((n_states,n_steps))
369370
xout[:,0]=X0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp