[SciPy-Dev] Problems with signal.dlti

Richard Hacker ha at igh.de
Thu Mar 18 07:31:13 EDT 2021


Hi everyone

I have the an issue with scipy.signal

I have a very simple first order low pass filter with difference equation:

y[n+1] = 0.9y[n] + 0.1u[n]

Its pole-zero representation is:
Y(z)/U(z) = 0.1/(z - 0.9)

and state-space representation is:
A = 0.9
B = 0.1
C = 1
D = 0

To get the frequency response I use signal.dfreqresp(). The problem is 
that while the pole-zero representation works, the state-space version 
barfs on the first call, but the results from both are identical. The 
second time I call the state-space version, everything is OK:

$ python3
 >>> import scipy
 >>> scipy.version.full_version
'0.19.1'

 >>> from scipy import signal
 >>> signal.dfreqresp(([0.1], [1.0, -0.9], True), 1)
(array([ 0.]), array([ 1.+0.j]))
 >>> #^^^ pole-zero representation -> OK

 >>> signal.dfreqresp(([0.9],[0.1],[1],[0], True), 1)
/usr/lib/python3/dist-packages/scipy/signal/filter_design.py:1452: 
BadCoefficients: Badly conditioned filter coefficients (numerator): the 
results may be meaningless
   "results may be meaningless", BadCoefficients)
(array([ 0.]), array([ 1.+0.j]))
 >>> #^^^ state-space representation first try -> BOO!

 >>> signal.dfreqresp(([0.9],[0.1],[1],[0], True), 1)
(array([ 0.]), array([ 1.+0.j]))
 >>> #^^^ state-space representation next try -> OK

BTW, the same behavior comes from the continuous time equivalent:
dy/dt = -0.1y + 0.1u
Pole-zero: Y(s)/U(s) = 0.1/(s + 0.1)
state-space: A = -0.1; B=0.1, C=1, D=0

Mit freundlichem Gruß

Richard Hacker

-- 
------------------------------------------------------------------------

Richard Hacker M.Sc.
richard.hacker at igh.de
Tel.: +49 201 / 36014-16

Ingenieurgemeinschaft IgH
Gesellschaft für Ingenieurleistungen mbH
Nordsternstraße 66
D-45329 Essen

Amtsgericht Essen HRB 11500
USt-Id.-Nr.: DE 174 626 722
Geschäftsführung:
- Dr.-Ing. Siegfried Rotthäuser
- Dr. Sven Beermann, Prokurist
Tel.: +49 201 / 360-14-0
http://www.igh.de

------------------------------------------------------------------------


More information about the SciPy-Dev mailing list