Skip to content

Commit a709dd6

Browse files
fix bandwidth function for DT systems
1 parent 854f5f7 commit a709dd6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

control/lti.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,14 @@ def bandwidth(self, dbdrop=-3):
211211
# solve for the bandwidth, use scipy.optimize.root_scalar() to
212212
# solve using bisection
213213
import scipy
214+
215+
if self.isdtime(strict=True):
216+
cvt_w = lambda w: np.exp(1j * w * self.dt)
217+
else:
218+
cvt_w = lambda w: 1j * w
219+
214220
result = scipy.optimize.root_scalar(
215-
lambda w: np.abs(self(w*1j)) - np.abs(dcgain)*10**(dbdrop/20),
221+
lambda w: np.abs(self(cvt_w(w))) - np.abs(dcgain)*10**(dbdrop/20),
216222
bracket=[omega[idx_dropped[0] - 1], omega[idx_dropped[0]]],
217223
method='bisect')
218224

0 commit comments

Comments
 (0)