[SciPy-user] probable bug in signal.lsim with repeated poles
Ryan Krauss
ryanlists@gmail....
Tue Feb 26 17:22:27 CST 2008
This may already be fixed or may be windows specific. The computer
having the problem is running the latest exe files:
In [3]: scipy.__version__
Out[3]: '0.6.0'
In [4]: numpy.__version__
Out[4]: '1.0.4'
I just tried running the file on an Ubuntu box running 0.7.0 from svn
a few weeks ago, and lsim and lsim2 give the same results.
Is an update to the windows exe's scheduled for anytime soon?
Thanks,
Ryan
On 2/26/08, Ryan Krauss <ryanlists@gmail.com> wrote:
> I think I have discovered a bug in lsim for systems with repeated
> roots in the charactersitic equation. The attached python file
> attempts to find the step response of a second order system that is
> critially damped:
>
> TF(s) = wn**2
> --------------------------------
> s**2 + 2*z*wn*s + wn**2
>
> where z = 1.
>
> The step response of this system based on inverse Laplace transform
> (see attached wxMaxima file) should be
> y(t) = -t*exp(-t)-exp(-t)+1
> when wn = 1.0
> signal.lsim2 comes up with the correct numeric answer (see good.png).
> Using signal.lsim, no error is thrown, but the answer is quite strange
> (see bad.png).
>
> I assume this has something to do with a repeated eigenvalue in the A matrix:
>
> In [69]: sys.A
> Out[69]:
> array([[-2., -1.],
> [ 1., 0.]])
>
> In [70]: eig(sys.A)
> Out[70]:
> (array([-1., -1.]),
> array([[-0.70710678, -0.70710678],
> [ 0.70710678, 0.70710678]]))
>
> It would be fine with me if lsim threw an error after checking for
> repeated eigenvalues. My code catches any errors thrown by lsim and
> tries to run lsim2 in an except clause. But giving a bad answer with
> no errors messed me up.
>
> Any thoughts?
>
>
> Ryan
>
>
More information about the SciPy-user
mailing list