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
{{ message }}
Repository navigation
unexpected behaviour of feedback combined with step_response #1102
Here is unexpected behaviour when I create an LTI system with ct.zpk, put it in unity feedback using ct.feedback, and compute the ct.step_response of the resulting feedback system. For the tested system, the result should be stable, but it is not.
Here's the code:
import control as ct
import numpy as np
import matplotlib.pyplot as plt
# the system
G = ct.zpk([],[0,-5,-10],1)
print(G)
K = 500
ct.root_locus_plot(G,initial_gain = 500)
This generates the root locus, indicating the result for the gain 500, which shows that the system is stable in closed loop, for this gain value.
Here's the code where unexpected behaviour occurs:
# put the system in unity feedback, with gain of 500
Gc = ct.feedback(G,K)
print(Gc)
# plot the step response
stepresp = ct.step_response(Gc)
stepresp.plot()
# check the pole locations
pzmap = ct.pole_zero_map(Gc)
print(pzmap.poles)
The response is clearly unstable, while the poles have negative real parts (i.e. stable)!
On the other hand, creating the feedback system directly with ct.tf (as was computed higher up, so theoretically the same feedback system), results in a stable step response.
This same issue came up in #1062 and was fixed in #1064. The issue is that timebase in zpk was not being set correctly and so it was getting interpreted as a discrete time system.
If you don't want to check out the latest main branch, you can fix the problem by changing the zpk call to
Activity
murrayrm commentedon Jan 19, 2025
This same issue came up in #1062 and was fixed in #1064. The issue is that timebase in zpk was not being set correctly and so it was getting interpreted as a discrete time system.
If you don't want to check out the latest main branch, you can fix the problem by changing the zpk call to