question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Step Response and step_info accuracy issue

See original GitHub issue

Hi, I found an accuracy issue related to control.step_response and control.step_info. To be specific, the issue is in _default_response_times() function. I have two system transfer function sys1 and sys2.They both have exactly the same frequency response.
sys1: num1 = [1.067e+05, 5.791e+04], den1 = [10.67, 1.067e+05, 5.791e+04] OR k = 10000, zeros = [-0.5426], poles = [-1e+04, -0.5426 ]

sys2: num2 = [1.881e+06], den2 = [188.1, 1.881e+06] OR k = 10000, zeros = [], poles = [-1e+04, ]

As you notice, sys1 has extra pole and zero where both have the same value.

The issue

When I plot the step responses for both systems, the plots are not matched. Also when I used step_info() to get the characteristics of the systems, I got a different results.

The code:

here is the code

num1 = [1.067e+05, 5.791e+04]
den1 = [10.67, 1.067e+05, 5.791e+04]
num2 = [1.881e+06]
den2 = [188.1, 1.881e+06]
sys_1 = control.TransferFunction(num1, den1)
sys_2 = control.TransferFunction(num2, den2)
t1, y1 = control.step_response(sys_1)
t2, y2 = control.step_response(sys_2)
print(control.step_info(sys_1))
print(control.step_info(sys_2))
plt.plot(t1, y1, t2, y2)
plt.grid()
plt.show()

Test on Matlab;

I tested the two systems in Matlab. The step() function gives the same step response plot for both systems, and stepinfo() results exactly the same values for both systems.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sawyerbfullercommented, Aug 19, 2020

PR #454 , which incorporates @ilayn’s code seems to fix this (both step responses are perfectly overlaid):

image

code output:

{'RiseTime': 0.0002118493270188449, 'SettlingTime': 0.0003500119315963524, 'SettlingMin': 0.8953357369737194, 'SettlingMax': 0.9895824151834175, 'Overshoot': 0.0, 'Undershoot': 0.0, 'Peak': 0.9895824151834175, 'PeakTime': 0.0004559365951057749, 'SteadyStateValue': 0.9895824151834175}
{'RiseTime': 0.00021183782855545226, 'SettlingTime': 0.000349992934135095, 'SettlingMin': 0.8952871451949131, 'SettlingMax': 0.9895287145194958, 'Overshoot': 0.0, 'Undershoot': 0.0, 'Peak': 0.9895287145194958, 'PeakTime': 0.0004559118484128211, 'SteadyStateValue': 0.9895287145194958}
1reaction
ilayncommented, Jul 29, 2020

I’ve tested for the given systems and indeed the responses are the same. The only remaining issue is when a system has Jordan blocks of significant poles but I think that is an open problem in the literature too. So with some reservation I would say it is robust but not fail-proof for every system.

Since we don’t have the commercial ODE solvers I think that would be all we can do for now via utilizing only pole-zero information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MATLAB stepinfo - MathWorks
stepinfo lets you compute step-response characteristics for a dynamic system model or for an array of step-response data.
Read more >
Chapter 4 HW Solution
The step response is shown in Figure 1 at right. At 0.2 seconds the response is 63% of the way to the final...
Read more >
1. Second-Order Systems: Step Response (Continuation
Comment on the accuracy of the approximations. (d) Plot the values of the 5% settling time T, using the function stepinfo as a...
Read more >
The Step Response | Control Systems in Practice - YouTube
Check out the other videos in this series: https://www.youtube.com/playlist?list=PLn8PRpmsu08pFBqgd_6Bi7msgkWFKL33bThis video covers a few ...
Read more >
Step response - Wikipedia
The step response of a system in a given initial state consists of the time evolution of its outputs when its control inputs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found