Skip to content

Commit 392f729

Browse files
committed
The following no longer causes a Numpy ValueError:
(cases where the order of the numerator is higher than the order of the denominator) s = control.tf.TransferFunction([1, 0], [1]) control.bode(s)
1 parent 9e878a9 commit 392f729

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/xferfcn.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,10 @@ def _common_den(self):
643643
# are the same size as the denominator.
644644
for i in range(self.outputs):
645645
for j in range(self.inputs):
646-
num[i][j] = insert(num[i][j], zeros(len(den) - len(num[i][j])),
647-
zeros(len(den) - len(num[i][j])))
646+
pad = len(den) - len(num[i][j])
647+
if(pad>0):
648+
num[i][j] = insert(num[i][j], zeros(pad),
649+
zeros(pad))
648650
# Finally, convert the numerator to a 3-D array.
649651
num = array(num)
650652
# Remove trivial imaginary parts. Check for nontrivial imaginary parts.

0 commit comments

Comments
 (0)