[SciPy-user] problem with lsim

Ryan Krauss ryanlists at gmail.com
Tue Nov 28 10:32:20 CST 2006


For what it's worth, this code runs fine on a Ubuntu machine running
numpy rc1 and a Windows machine running numpy 1.0b5.  The machine that
has the problem is running Windows and numpy rc2.  All are running
scipy 0.5.1.

Ryan

On 11/27/06, Ryan Krauss <ryanlists at gmail.com> wrote:
> I am having a problem with signal.lsim.  Here is a script that
> recreates my problem:
>
> from scipy import *
> from pylab import plot
>
> t=arange(0,10,0.01)
> u=ones(shape(t))
> sys=signal.lti([1.0],[1.0,1.0])
> out=signal.lsim(sys,u,t)
> plot(out[0],out[1])
>
> Here is the error message:
> I:\lsim_test.py
>       5 u=ones(shape(t))
>       6 sys=signal.lti([1.0],[1.0,1.0])
> ----> 7 out=signal.lsim(sys,u,t)
>       8 plot(out[0],out[1])
>       9
>
> c:\python24\lib\site-packages\scipy\signal\ltisys.py in lsim(system, U, T, X0, i
> nterp)
>     403     vt = transpose(v)
>     404     vti = linalg.inv(vt)
> --> 405     GT = dot(dot(vti,diag(numpy.exp(dt*lam))),vt).astype(xout.dtype.char
> )
>     406     ATm1 = linalg.inv(AT)
>     407     ATm2 = dot(ATm1,ATm1)
>
> C:\Python24\Lib\site-packages\numpy\lib\twodim_base.py in diag(v, k)
>      66             i = arange(0,n+k)
>      67             fi = i+(i-k)*n
> ---> 68         res.flat[fi] = v
>      69         return res
>      70     elif len(s)==2:
>
> TypeError: can't convert complex to float; use abs(z)
> WARNING: Failure executing file: <lsim_test.py>
>
> My script is also attached if someone wants to run it.
>
> How do I fix this?
>
> Thanks,
>
> Ryan
>
>
>


More information about the SciPy-user mailing list