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
lsim is slow #48
Comments
Since I think we already depend on |
Unfortunately, no, because the LTI objects in This raises another issue, that ideally it would be nice if these objects were all compatible with one another, since a lot of stuff is already included in |
Defaulting to the general-purpose solver was also motivated by how scipy's Sawyer Sawyer B. Fuller, Ph.D. On Fri, Mar 20, 2015 at 9:18 PM, Richard Murray notifications@github.com
|
I was just planning to call |
I've never looked into why scipy's lsim fails with a pole at the origin, Sawyer Sawyer B. Fuller, Ph.D. On Fri, Mar 20, 2015 at 10:31 PM, Clancy Rowley notifications@github.com
|
The
lsim
command can be much, much slower thanscipy.signal.lsim
. For instance, consider the following example (run in IPython for%timeit
):For me,
scipy.signal.lsim
gives 17.4 ms per loop, andcontrol.lsim
gives 7.64 s per loop.The current implementation of
control.lsim
calls a general-purpose ODE solver at each step. I think it is better to assume a linear system with constant-spaced timesteps int
(as done inscipy.signal.lsim
and in Matlab'slsim
), and then one can evaluate the matrix exponential once and apply it at each step. If non-uniform timesteps are desired (which is very rare, at least in my experience), then we could have an alternative routinecontrol.lsim2
that calls the general-purpose ODE solver--that is what is done inscipy.signal
.The text was updated successfully, but these errors were encountered: