Skip to content

Commit 73ce2fe

Browse files
committed
wrong variable (dt does not exist, it's Ts)
Trying to use c2d with method 'zoh' fails with: ``` Traceback (most recent call last): File "system_example.py", line 56, in <module> syst_fake_dis = c2d(syst_fake, 0.01, method='zoh') File "/usr/local/lib/python2.7/dist-packages/control-0.6d-py2.7.egg/control/matlab.py", line 1519, in c2d return sample_system(sysc, Ts, method) File "/usr/local/lib/python2.7/dist-packages/control-0.6d-py2.7.egg/control/dtime.py", line 87, in sample_system sysd = TransferFunction(scipySysD[0][0],scipySysD[1], dt) NameError: global name 'dt' is not defined ```
1 parent 362f949 commit 73ce2fe

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/dtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ def sample_system(sysc, Ts, method='matched'):
7979
elif method == 'tustin':
8080
sys = [sysc.num[0][0], sysc.den[0][0]]
8181
scipySysD = cont2discrete(sys, Ts, method='bilinear')
82-
sysd = TransferFunction(scipySysD[0][0], scipySysD[1], dt)
82+
sysd = TransferFunction(scipySysD[0][0], scipySysD[1], Ts)
8383

8484
elif method == 'zoh':
8585
sys = [sysc.num[0][0], sysc.den[0][0]]
8686
scipySysD = cont2discrete(sys, Ts, method='zoh')
87-
sysd = TransferFunction(scipySysD[0][0],scipySysD[1], dt)
87+
sysd = TransferFunction(scipySysD[0][0],scipySysD[1], Ts)
8888

8989
elif method == 'foh' or method == 'impulse':
9090
raise ValueError("Method not developed yet")

0 commit comments

Comments
 (0)