[Scipy-svn] r2196 - trunk/Lib/signal

scipy-svn at scipy.org scipy-svn at scipy.org
Tue Sep 12 03:37:38 CDT 2006


Author: stefan
Date: 2006-09-12 03:37:24 -0500 (Tue, 12 Sep 2006)
New Revision: 2196

Modified:
   trunk/Lib/signal/ltisys.py
Log:
Use interp1d in ltsys.


Modified: trunk/Lib/signal/ltisys.py
===================================================================
--- trunk/Lib/signal/ltisys.py	2006-09-08 16:23:16 UTC (rev 2195)
+++ trunk/Lib/signal/ltisys.py	2006-09-12 08:37:24 UTC (rev 2196)
@@ -7,7 +7,7 @@
 from filter_design import tf2zpk, zpk2tf, normalize
 import numpy
 from numpy import product, zeros, \
-     array, dot, transpose, arange, ones
+     array, dot, transpose, arange, ones, nan_to_num
 from numpy.oldnumeric import Float
 import scipy.interpolate as interpolate
 import scipy.integrate as integrate
@@ -330,10 +330,10 @@
     # for each output point directly integrate assume zero-order hold
     #   or linear interpolation.
 
-    ufunc = interpolate.linear_1d(T, U, axis=0, bounds_error=0, fill_value=0)
+    ufunc = interpolate.interp1d(T, U, kind='linear', axis=0, bounds_error=False)
 
     def fprime(x, t, sys, ufunc):
-        return dot(sys.A,x) + squeeze(dot(sys.B,ufunc([t])))
+        return dot(sys.A,x) + squeeze(dot(sys.B,nan_to_num(ufunc([t]))))
 
     xout = integrate.odeint(fprime, X0, T, args=(sys, ufunc))
     yout = dot(sys.C,transpose(xout)) + dot(sys.D,transpose(U))



More information about the Scipy-svn mailing list