!pip install control import numpy as np import matplotlib.pyplot as plt from control.matlab import * num = np.array([1]) den = np.array([1, 1, 0]) G = tf(num, den) ar = 2 rlocus(G) fig = plt.gcf().set_size_inches(8, 8) plt.xlim([-ar, ar]), plt.ylim([-ar, ar]) plt.grid() plt.show() num = np.array([1,2]) den = np.array([1,4,0,0]) G = tf(num, den) ar = 10 rlocus(G) fig = plt.gcf().set_size_inches(8, 8) plt.xlim([-ar, ar]), plt.ylim([-ar, ar]) plt.grid() plt.show() zeros = [9j, -9j, -5] poles = [0, 0, 10j, -10j] G = zpk(zeros, poles, 1) ar = 20 rlocus(G) fig = plt.gcf().set_size_inches(8, 8) plt.xlim([-ar, ar]), plt.ylim([-ar, ar]) plt.grid() plt.show() zeros = [1] poles = [2, 3, -10] G = zpk(zeros, poles, 1) ar = 20 rlocus(G) fig = plt.gcf().set_size_inches(8, 8) plt.xlim([-ar, ar]), plt.ylim([-ar, ar]) plt.grid() plt.show() zeros = [1] poles = [2, 3, -10, -20] G = zpk(zeros, poles, 1) kvec_ = [0,10,200,1050] rlist, klist = rlocus(G, kvec_,plot=False); print(rlist) ar = 20 rlocus(G) fig = plt.gcf().set_size_inches(8, 8) plt.xlim([-ar, ar]), plt.ylim([-ar, ar]) plt.plot(rlist[2].real, rlist[2].imag, "rx", label=f"K={kvec_[2]}") plt.plot(rlist[3].real, rlist[3].imag, "gx", label=f"K={kvec_[3]}") plt.legend() plt.grid() plt.show() zr = [-3, 11j, -11j] pl = [0, 0, 10j, -10j,-11,-11] G = zpk(zr, pl, 1) ar = 20 rlocus(G) fig = plt.gcf().set_size_inches(8, 8) plt.xlim([-ar, ar]), plt.ylim([-ar, ar]) plt.grid() plt.show()