You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I found a bug in _common_den() method, line 935 in xferfcn.py file. The line code is :
num[i, j, maxindex+1-len(numpoly):maxindex+1] = numpoly
The error happen when numerator order is larger than denominator order. The error message is "ValueError: could not broadcast input array from shape (4) into shape (1)"
# figure out maximum number of poles, for sizing the den
maxindex=max([len(p) forpinpoles])
den=zeros((self.inputs, maxindex+1), dtype=float)
num=zeros((max(1, self.outputs, self.inputs),
max(1, self.outputs, self.inputs),
maxindex+1),
dtype=float)
This could be extended to use the maximum of numerator and denominator, but I am not sure TD04AD will handle this, as it likely expects a proper transfer function? The documenation of TD04AD seems to imply that always denorder > numorder.
_common_den() should not fail with a ValueError though. A check and proper exception should be raised, or a return of the correct num and den and a warning display.
Activity
bnavigator commentedon Jan 27, 2020
Yes the
numanddenarrays are sized according to the order of the denominatorpython-control/control/xferfcn.py
Lines 900 to 906 in 66bee9d
This could be extended to use the maximum of numerator and denominator, but I am not sure
TD04ADwill handle this, as it likely expects a proper transfer function? The documenation ofTD04ADseems to imply that alwaysdenorder > numorder._common_den()should not fail with aValueErrorthough. A check and proper exception should be raised, or a return of the correct num and den and a warning display.rlegnain commentedon Jan 28, 2020
I think a return of num and den with warning message will be good.
Thanks
murrayrm commentedon Jul 11, 2020
Fixed in PR #370