[SciPy-user] Small problem with scipy.signal

Clovis Goldemberg clovisgo at gmail.com
Tue Dec 11 14:09:34 EST 2007


   I am having some problems with scipy.signal
   (specifically with scipy.signal.step) which can be
   explained by the following text,
   which was edited with some comments.
   Configuration is also given in the text.

   #####################################
   Microsoft Windows XP [Version 5.1.2600]
   (C) Copyright 1985-2001 Microsoft Corp.
   C:\>d:\python25\python
   Python 2.5.1 (r251:54863, Apr 18 2007,
   win32
   Type "help", "copyright", "credits" or
   >>> import scipy.signal as ss
   >>> import scipy
   >>> scipy.__version__
   '0.6.0'
   >>> import numpy
   >>> numpy.__version__
   '1.0.4'
   #####################################
   # numpy.test(10,2) runs without any problem
   # scipy.test(10,2) runs without any problem
   #####################################

- Ignored:
   >>> num=[1.0]
   >>> den=[1.0,1.0]
   >>> ss.step((num,den))
   #####################################
   # This works fine!
   # The transfer function would be "1/(1s+1)"
   # which is a simple low-pass filter.
   #####################################
   (array([ 0.  ,  0.07,  0.14,  0.21,  0.
           0.63,  0.7 ,  0.77,  0.84,  0.9
           1.26,  1.33,  1.4 ,  1.47,  1.5
           1.89,  1.96,  2.03,  2.1 ,  2.1
           2.52,  2.59,  2.66,  2.73,  2.8
           3.15,  3.22,  3.29,  3.36,  3.4
           3.78,  3.85,  3.92,  3.99,  4.0
           4.41,  4.48,  4.55,  4.62,  4.6
           5.04,  5.11,  5.18,  5.25,  5.3
           5.67,  5.74,  5.81,  5.88,  5.9
           6.3 ,  6.37,  6.44,  6.51,  6.5
   array([ 0.        ,  0.06760618,  0.1306
           0.29531191,  0.34295318,  0.387
           0.5034147 ,  0.53698693,  0.568
           0.65006225,  0.67372021,  0.695
           0.75340304,  0.77007451,  0.785
           0.82622606,  0.83797425,  0.848
           0.87754357,  0.88582238,  0.893
           0.91370641,  0.91954039,  0.924
           0.93918994,  0.94330107,  0.947
           0.95714787,  0.96004494,  0.962
           0.96980262,  0.97184415,  0.973
           0.97872026,  0.98015891,  0.981
           0.98500442,  0.98601822,  0.986
           0.9894328 ,  0.9901472 ,  0.990
           0.99255342,  0.99305685,  0.993
           0.99475248,  0.99510725,  0.995
           0.99630214,  0.99655213,  0.996
           0.99739416,  0.99757033,  0.997
           0.9981637 ,  0.99828784,  0.998
           0.99870598,  0.99879346,  0.998


   >>> den=[1.0,0.0]
   >>> ss.step((num,den))
   #####################################
   # This fails!
   # The transfer function would be "1/s"
   # which is a simple integrator.
   #####################################

   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "d:\python25\lib\site-packages\s

       vals = lsim(sys, U, T, X0=X0)
     File "d:\python25\lib\site-packages\s

       xout[0] = X0
   IndexError: index out of bounds
   >>>

   #####################################
   Any suggestion?
   Thanks for your kind support.

- Done.



---------- Forwarded message ----------
From: "Clovis Goldemberg" <clovisgo at gmail.com>
To: scipy-user-request at scipy.org
Date: Mon, 10 Dec 2007 09:53:26 -0200
Subject: Small problem with "scipy.signal.step"
I'm having a small problem with scipy.signal, which is exposed in the
following text,
which was edited with some comments.

#####################################
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>d:\python25\python
Python 2.5.1 (r251:54863, Apr 18 2007,
win32
Type "help", "copyright", "credits" or
>>> import scipy.signal as ss
>>> import scipy
>>> scipy.__version__
'0.6.0'
>>> import numpy
>>> numpy.__version__
'1.0.4'

#####################################
# numpy.test(10,2) runs without any problem
# scipy.test(10,2) runs without any problem
#####################################

>>> num=[1.0]
>>> den=[1.0,1.0]
>>> ss.step((num,den))
#####################################
# This works fine!
# The transfer function would be "1/(1s+1)"
# which is a simple low-pass filter.
#####################################
(array([ 0.  ,  0.07,  0.14,  0.21,  0.
        0.63,  0.7 ,  0.77,  0.84,  0.9
        1.26,  1.33,  1.4 ,  1.47,  1.5
        1.89,  1.96,  2.03,  2.1 ,  2.1
        2.52,  2.59,  2.66,  2.73,  2.8
        3.15,  3.22,  3.29,  3.36,  3.4
        3.78,  3.85,  3.92,  3.99,  4.0
        4.41,  4.48,  4.55,  4.62,  4.6
        5.04,  5.11,  5.18,  5.25,  5.3
        5.67,  5.74,  5.81,  5.88,  5.9
        6.3 ,  6.37,  6.44,  6.51,  6.5
rray([ 0.        ,  0.06760618,  0.1306
        0.29531191,  0.34295318,  0.387
        0.5034147 ,  0.53698693,  0.568
        0.65006225,  0.67372021,  0.695
        0.75340304,  0.77007451,  0.785
        0.82622606,  0.83797425,  0.848
        0.87754357,  0.88582238,  0.893
        0.91370641,  0.91954039,  0.924
        0.93918994,  0.94330107 ,  0.947
        0.95714787,  0.96004494,  0.962
        0.96980262,  0.97184415,  0.973
        0.97872026,  0.98015891,  0.981
        0.98500442,  0.98601822,  0.986
        0.9894328 ,  0.9901472 ,  0.990
        0.99255342,  0.99305685,  0.993
        0.99475248,  0.99510725,  0.995
        0.99630214,  0.99655213,  0.996
        0.99739416,  0.99757033,  0.997
        0.9981637 ,  0.99828784,  0.998
        0.99870598,  0.99879346,  0.998


>>> den=[1.0,0.0]
>>> ss.step((num,den))
#####################################
# This fails!
# The transfer function would be "1/s"
# which is a simple integrator.
#####################################

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "d:\python25\lib\site-packages\s

    vals = lsim(sys, U, T, X0=X0)
  File "d:\python25\lib\site-packages\s

    xout[0] = X0
IndexError: index out of bounds
>>>

#####################################
Any suggestion?
Thanks for your kind support.
Clovis Goldemberg
Escola Politecnica da USP
Brasil



More information about the SciPy-User mailing list