You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Hi @rlegnain indeed the current version of step_response chooses the time resolution of the step response based only on the poles and not the zeros. In particular, pole-zero cancellations will give it troubles. I wrote an update that is now in the development branch of the library that has an improved way of calculating the time vector, but it does not solve this problem.
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.
Activity
[-]Step Response and step[/-][+]Step Response and step_info accuracy issue[/+]bnavigator commentedon Jul 29, 2020
The only "inaccuracy" here is the resolution of the time vectors
t1, t2:with python-control 0.8.3:
Even with current master branch, which has #420 merged:
The magnitude of the canceling pole in
sys1still prevents the return of a good default time vector.rlegnain commentedon Jul 29, 2020
Thanks bnavigator,
Any plans to solve this? people coming form Matlab love to see similar results as in Matlab.
murrayrm commentedon Jul 29, 2020
Flagging this for @sawyerbfuller to have a look since he wrote the current default response time calculation.
sawyerbfuller commentedon Jul 29, 2020
Hi @rlegnain indeed the current version of
step_responsechooses the time resolution of the step response based only on the poles and not the zeros. In particular, pole-zero cancellations will give it troubles. I wrote an update that is now in the development branch of the library that has an improved way of calculating the time vector, but it does not solve this problem.@ilayn was working on a solution that takes zeros into account in #287, and he posted his code here https://github.com/ilayn/harold/blob/master/harold/_time_domain.py#L280-L454, but I don't know how close he got to having a robust solution.
ilayn commentedon 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.
rlegnain commentedon Jul 30, 2020
Thanks all.
sawyerbfuller commentedon Aug 19, 2020
PR #454 , which incorporates @ilayn's code seems to fix this (both step responses are perfectly overlaid):
code output: