[Scipy-tickets] [SciPy] #1096: tf2ss and "Improper transfer function."

SciPy Trac scipy-tickets@scipy....
Thu Jan 21 14:17:24 CST 2010

#1096: tf2ss and "Improper transfer function."
 Reporter:  jary                              |       Owner:  somebody
     Type:  defect                            |      Status:  new     
 Priority:  normal                            |   Milestone:  0.7.1   
Component:  scipy.signal                      |     Version:  0.7.0   
 Keywords:  tf2ss transfer function impulse.  |  

Comment(by jary):

 Replying to [comment:1 josefpktd]:
 > Do you have a test case, that shows the wrong behavior, and the correct
 result with the bugfix?

 Test case:
 from scipy.signal import freqz, tf2ss, firwin
 from numpy import array
 h =  firwin(2, .5)
 w, n = freqz(h, 1)
 ss = tf2ss(h, 1)

 Without bugfix, it dies:
 python tfbug.py
 Traceback (most recent call last):
   File "tfbug.py", line 5, in <module>
     ss = tf2ss(h, 1)
   File "/usr/lib/python2.6/site-packages/scipy/signal/ltisys.py", line 40,
 in tf2ss
     raise ValueError, "Improper transfer function."

 With bugfix, it continues processing and returns.

 The freqz() doesn't complain with same input so I guess the TF should be
 OK, so there definitely was a bug raising false error about Improper
 transfer function. My thinking is also supported by that, that h
 coefficients are generated automatically, with firwin().

 Even that I fixed this, I still have doubts about correctness of tf2ss.
 Someone who understands the state space LTIS better should check it -- I
 met the problem that the ss2tf function rises
 ---> 97         raise ValueError, "A must be square."
 every time I try to convert output of SS back to TF.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1096#comment:2>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list