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

SciPy Trac scipy-tickets@scipy....
Thu Jan 21 17:57:02 CST 2010


#1096: tf2ss and "Improper transfer function."
----------------------------------------------+-----------------------------
 Reporter:  jary                              |       Owner:  somebody    
     Type:  defect                            |      Status:  needs_review
 Priority:  normal                            |   Milestone:  0.7.1       
Component:  scipy.signal                      |     Version:  0.7.0       
 Keywords:  tf2ss transfer function impulse.  |  
----------------------------------------------+-----------------------------
Changes (by josefpktd):

  * status:  new => needs_review


Comment:

 The error message could be more helpful, the requirement is that `den` is
 at least
 as long as `num`. the following works

 signal.tf2ss(h, [1,0,0,0])

 I didn't look closely enough to see why the length condition is required
 in this
 function, but in other function it is a requirement to work with numpy
 polynomials.

 So, I don't think your fix is the right solution.

 But at least documentation and the error message could be improved


 Here is a roundtrip example, that I managed a while ago

 {{{
 import numpy as np
 from scipy import signal

 dvec = np.array([1,2,3,4])
 A1 = np.array([-dvec,[1,0,0,0],[0,1,0,0],[0,0,1,0]])
 B1 = np.array([[1,0,0,0]]).T  # wrong dimension, this requires D has one
 column
 B1 = np.eye(4)
 C1 = np.array([[1,2,3,4]])
 D1 = np.zeros((1,4))
 print signal.ss2tf(A1,B1,C1,D1)
 #same as
 http://en.wikipedia.org/wiki/State_space_(controls)#Canonical_realizations

 signal.ss2tf(*signal.tf2ss(*signal.ss2tf(A1,B1,C1,D1)))
 np.testing.assert_almost_equal(signal.ss2tf(*signal.tf2ss(*signal.ss2tf(A1,B1,C1,D1)))[0],signal.ss2tf(A1,B1,C1,D1)[0])
 }}}

 this implies the following example:

 {{{
 signal.tf2ss(array([[ 0.,  1.,  2.,  3.,  4.]]), array([ 1.,  1.,  2.,
 3.,  4.]))
 (array([[-1., -2., -3., -4.],
        [ 1.,  0.,  0.,  0.],
        [ 0.,  1.,  0.,  0.],
        [ 0.,  0.,  1.,  0.]]), array([[ 1.],
        [ 0.],
        [ 0.],
        [ 0.]]), array([[ 1.,  2.,  3.,  4.]]), array([ 0.]))
 }}}

 My impression is that lti is a bit lonely, no tests and not enough
 attention.

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


More information about the Scipy-tickets mailing list