[SciPy-User] scipy.signal.ss2tf nests numerator 1 deeper, is this a bug ?

Stef Mientki stef.mientki at gmail.com
Sat Aug 15 13:19:08 EDT 2009


hello,

creating a module that accepts any LTI representation,
my program didn't work, because ss2tf nests the numerator 1 deeper.

Is this a bug ?

from scipy import signal
from scipy.signal import tf2ss, ss2tf

print '======== HighPass Filter ========'
print 'Filter-1: IIR (Butterworth), 0.06*fn, -50dB'
filt = signal.iirdesign( 0.06, 0.002, 1, 50, 0, 'butter')

Space_State = tf2ss ( *filt )
filt2 = ss2tf ( *Space_State )
print 'orginal transfer function', filt
print 'tf --> Space_State --> tf', filt2


OUTPUT:
======== HighPass Filter ========
Filter-1: IIR (Butterworth), 0.06*fn, -50dB
orginal transfer function (array([ 0.92410511, -1.84821022,  
0.92410511]), array([ 1.        , -1.84244187,  0.85397858]))
tf --> Space_State --> tf (array([[ 0.92410511, -1.84821022,  
0.92410511]]), array([ 1.        , -1.84244187,  0.85397858]))


Is there a handy work around ?
One of things I want to do is to calculate the frequency response
(but I guess more things that I want will raise problems :-)
So this generates an error:
 
h, w = signal.freqz ( *filt2 )

And I have to use this statement:

h, w = signal.freqz ( filt2 [0] [0], filt2 [1] )

thanks,
Stef Mientki






More information about the SciPy-User mailing list