Skip to content

IndexError: index -1 is out of bounds for axis 0 with size 0 #1014

Closed

Description

@NikolaiVChr

I get this:

Traceback (most recent call last):
  File "C:\Users\me\PycharmProjects\f\control1.py", line 17, in <module>
    S = ct.step_info(sysdata=y_out2, T=T2)
  File "C:\Users\me\PycharmProjects\f\venv\lib\site-packages\control\timeresp.py", line 1614, in step_info
    settled = np.where(
IndexError: index -1 is out of bounds for axis 0 with size 0

From this: (just a simple integrator TF)

import control as ct
import numpy as np

num = [0,5]
den = [1,0]

H = ct.TransferFunction(num, den)

t = np.arange(start=0, stop=2, step=1/120)

T2, y_out2 = ct.timeresp.impulse_response(sys=H, T=t)
pyplot.figure(1)
pyplot.plot(T2, y_out2)
pyplot.grid(True)
pyplot.show(block=False)
S = ct.step_info(sysdata=y_out2, T=T2)

pyplot.show()

Control v0.10.0
Numpy 1.26.4
Scipy 1.14.0

Activity

  1. NikolaiVChr commented on Jun 27, 2024

    @NikolaiVChr
    Author

    I get same error with:

    num = [1,5]
    den = [1,0]

  2. NikolaiVChr commented on Jun 27, 2024

    @NikolaiVChr
    Author

    Oh, and thank you for great library. Its awesome.

  3. murrayrm commented on Jun 27, 2024

    @murrayrm
    Member

    The bug is in the step_info function. The impulse response for a pure integrator is a constant output and step_info gets confused when it is passed something that doesn't look like a step response.

    Fixing the bug should be straightforward: we should probably issue a warning when we can't find the features we are looking for in a typical step response.

  4. added this to the 0.10.1 milestone on Jun 27, 2024
  5. slivingston commented on Jul 13, 2024

    @slivingston
    Member

    Fixed in #1029

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions