Description
Hi,
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.
# create the feed
Gcexpl = ct.tf([],[1,15,50,500])
print(Gcexpl)
steprespexpl = ct.step_response(Gcexpl)
steprespexpl.plot()
This step response is stable, as expected.
This indicates that the system generated by ct.feedback
is not valid.
Any clue?
Thanks in advance!