[Scipy-tickets] [SciPy] #577: Problem with step function in signal.scipy.ltisys.py

SciPy Trac scipy-tickets@scipy....
Sun May 2 19:12:33 CDT 2010


#577: Problem with step function in signal.scipy.ltisys.py
-----------------------------------+----------------------------------------
 Reporter:  clovisgo               |       Owner:  somebody    
     Type:  defect                 |      Status:  needs_review
 Priority:  normal                 |   Milestone:  0.8.0       
Component:  scipy.signal           |     Version:              
 Keywords:  step function problem  |  
-----------------------------------+----------------------------------------

Comment(by warren.weckesser):

 r6366 and r6367 are related to this ticket.  In r6366, a change was made
 that is similar to the patch suggested here, so a system for which the
 smallest magnitude of an eigenvalue is zero will not cause an error when
 it computes the default time values for a step response.

 The problem with using step(), however, is that it uses lsim() to compute
 the solution, and lsim() uses an analytical solution that is only valid if
 the system matrix is nonsingular and not defective.

 In r6367, I added step2(), which uses lsim2(), and lsim2() uses odeint to
 compute the solution.

 So, until someone implements a more robust version of step(), a work-
 around for its problems is to use the function step2(). (That's
 scipy.signal.step2; I didn't add a corresponding method to the lti
 object.)

 Example:
 {{{
 In [1]: from scipy.signal import lti, step2

 In [2]: s = lti([1.], [1., 0.])

 In [3]: t, y = step2(s, atol=1e-8, rtol=1e-6)

 In [4]: t[:5], y[:5]
 Out[4]:
 (array([ 0.        ,  0.07070707,  0.14141414,  0.21212121,  0.28282828]),
  array([ 0.        ,  0.07070707,  0.14141414,  0.21212121,  0.28282828]))

 In [5]: t[-5:], y[-5:]
 Out[5]:
 (array([ 6.71717172,  6.78787879,  6.85858586,  6.92929293,  7.        ]),
  array([ 6.71717172,  6.78787879,  6.85858586,  6.92929293,  7.        ]))

 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/577#comment:6>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list