Skip to content


ss2tf returns num as 2D array instead of 1D (Trac #1879) #2398

scipy-gitbot opened this Issue · 2 comments

3 participants


Original ticket on 2013-03-28 by trac user guo, assigned to @cournape.

I use

from scipy import signal
(num_x, den_x) = signal.ss2tf(A,B,C,D)


A = [[ 1, -1], [ 1,  0]]
B = [[ 1.], [ 0.]]
C = [[0, 1]]
D = [[ 0.]]

and it returns

num = [[ 0.  0.  1.]]
den = [ 1. -1.  1.]

We see that num is a 2D array. According to the documentation it should be a 1D array.
This seems to be caused by line 180 in

num = numpy.zeros((nout, num_states + 1), type_test.dtype)

If the goal is to match the matlab functionality of ss2f, then this is the correct behavior. num is a 2D array to accommodate systems with multiple outputs. In this case, the documentation should be changed to reflect this.

SciPy member

Matching Matlab is in general not the goal I'd say; it doesn't even have 1-D arrays (which is extremely annoying). But in this case the current behavior looks fine to me (always 2-D is easy to explain) and changing the docs is the right thing to do. Care to send a PR?

@JustinL42 JustinL42 referenced this issue
Commit has since been removed from the repository and is no longer available.
@JustinL42 JustinL42 added a commit to JustinL42/scipy that referenced this issue
@JustinL42 JustinL42 updated ss2tf docstring in response to Issue #2398 a0f117a
@rgommers rgommers closed this in aec30e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.