Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
scipy-gitbot opened this issue Apr 25, 2013 · 2 comments
Closed

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

scipy-gitbot opened this issue Apr 25, 2013 · 2 comments
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected good first issue Good topic for first contributor pull requests, with a relatively straightforward solution Migrated from Trac scipy.signal
Milestone

Comments

@scipy-gitbot
Copy link

Original ticket http://projects.scipy.org/scipy/ticket/1879 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)

with

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 ltisys.py

num = numpy.zeros((nout, num_states + 1), type_test.dtype)
@JustinL42
Copy link
Contributor

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.

@rgommers
Copy link
Member

rgommers commented Oct 3, 2013

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected good first issue Good topic for first contributor pull requests, with a relatively straightforward solution Migrated from Trac scipy.signal
Projects
None yet
Development

No branches or pull requests

3 participants