[SciPy-user] Fwd: signal.lti(A,B,C,D) with D=0

William Purcell williamhpurcell@gmail....
Wed Feb 18 08:50:47 CST 2009


I think that scipy.signal is set up to do what I need to do, but I am
having trouble with ss2tf. Line 149 of ltisys is

type_test = A[:,0] + B[:,0] + C[0,:] + D

but I keep getting the error

Traceback (most recent call last):
  File "test_lti.py", line 13, in <module>
    x = scipy.signal.ss2tf(A,B,C,D)
  File "/usr/lib/python2.5/site-packages/scipy/signal/ltisys.py", line
153, in ss2tf
    type_test = A[:,0] + B[:,0] + C[0,:] + D
ValueError: shape mismatch: objects cannot be broadcast to a single shape

This is because A is nxn, B is nxi, C is mxn, and D is mxi (I hope I
got that right). My point is that type_test slices the 'n' dimension
of each matrix and D doesn't have an 'n' dimension. I think that the '
+ D' needs to be removed from type_test or it needs to be padded with
n-m elements for the test.

I attached a test that reproduces the error. If I comment out '+ D' in
ss2tf, it seems to work just fine and return what I want.

One last thing, I think that signal.lti should pass an input kwarg to
ss2zpk and ss2tf so that you don't have to always look at the first
input (0 index).  In other words, ss2zpk and ss2tf both have a input
kwarg to tell which input to use and I think that signal.lti should
have the same feature.

Let me know your thoughts.

Thanks,
Bill
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_lti.py
Type: text/x-python
Size: 176 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20090218/0ca01237/attachment.py 


More information about the SciPy-user mailing list