[SciPy-user] problem with lsim
Ryan Krauss
ryanlists at gmail.com
Thu Nov 30 16:06:18 EST 2006
I was hoping that updating my versions would fix this problem, but
after wrestling with building from source under windows (and mostly
getting it working), I still get:
In [2]: run lsim_test.py
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most recent call
last)
e:\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)
400 vt = transpose(v)
401 vti = linalg.inv(vt)
--> 402 GT = dot(dot(vti,diag(numpy.exp(dt*lam))),vt).astype(xout.dtype)
403 ATm1 = linalg.inv(AT)
404 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>
where the script contains:
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])
Ryan
On 11/28/06, Ryan Krauss <ryanlists at gmail.com> wrote:
> 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