# Scipy.signal.dimpulse(system): how to translate a StateSpace to a “system”? [closed]

The command scipy.signal.dimpulse(system, x0=None, t=None, n=None) does not seem to accept a scipy StateSpace as an input to its system parameter.

Here is my code, and the error. The goal is to generate a series of k-th order Laguerre basis functions.

k=5
num_points=100
alpha = 0.01

# create sys1
nn = np.sqrt(1-alpha**2)
n1 = [0,nn]
p1 = [1,-alpha]
sys1 = control.tf2ss(n1, p1)

# create sys0
n0 = [-alpha, 1]
p0 = [1,-alpha]
sys0 = control.tf2ss(n0, p0) #type(sys0) is an "instance", not a "StateSpace"

# create k-th order series
for i in range(2, k):
result_sys = control.matlab.series(sys0, sys1)

# generate discrete impulse response

result_lti = result_sys.returnScipySignalLti() #(maybe Lti format will work as input...no.)

y1 = scipy.signal.dimpulse(result_sys,x0=1,n=num_points+1)


The last command gives this error message:

Traceback (most recent call last):

File "<ipython-input-8-a569a95625b6>", line 55, in <module>
y1 = scipy.signal.dimpulse(result_sys,x0=1,n=num_points+1)

File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/scipy/signal/dltisys.py", line 173, in dimpulse
A, B, C, D, dt = _system_to_statespace(system)

File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/scipy/signal/dltisys.py", line 20, in _system_to_statespace
if len(system) == 3:

AttributeError: StateSpace instance has no attribute '__len__


Also, the control.tf2ss command returns an 'instance', not a 'StateSpace', which seems unusual.

How can I translate the outputs from control.tf2ss and control.matlab.series into acceptable input formats to the scipy.signal.dimpulse system?

Thank you!

## closed as off-topic by Gilles, Laurent Duval, Matt L., jojek♦Aug 22 '16 at 9:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "General programming questions are off-topic here, but can be asked on Stack Overflow." – Gilles, Matt L., jojek
If this question can be reworded to fit the rules in the help center, please edit the question.