!pip install control import numpy as np import matplotlib.pyplot as plt from control.matlab import * num1 = np.array([1]) den1 = np.array([1, 1]) G1 = tf(num1, den1) num2 = np.array([100]) den2 = np.array([1, 100]) G2 = tf(num2, den2) num3 = np.array([10000]) den3 = np.array([1, 2*0.1*100, 10000]) G3 = tf(num3, den3) t = np.linspace(0, 5, 10000) y, t = step(G1*G3, t) y_r, t_r = step(G1, t) plt.figure(dpi=100) plt.plot(t, y, label='Full', alpha=0.8) plt.plot(t_r, y_r, label='Reduced', alpha=0.8) plt.xlabel(r'$t$ (sec)') plt.ylabel(r'$y$') plt.title('Step response') plt.legend() plt.grid() plt.show() num1 = np.array([1]) den1 = np.array([1, 1]) G1 = tf(num1, den1) num2 = np.array([1]) den2 = np.array([1, 0.01]) G2 = tf(num2, den2) num3 = np.array([1]) den3 = np.array([1, 0]) G3 = tf(num3, den3) t = np.linspace(0, 5, 10000) y, t = step(G1*G2, t) y_r, t_r = step(G1*G3, t) plt.figure(dpi=100) plt.plot(t, y, label='Full', alpha=0.8) plt.plot(t_r, y_r, label='Reduced', alpha=0.8) plt.xlabel(r'$t$ (sec)') plt.ylabel(r'$y$') plt.title('Step response') plt.legend() plt.grid() plt.show() ts = np.arange(0, 15, 0.01) G = tf([1], [1, 1]) K = tf([2, 2.5], [1, 0]) CL = feedback(K*G, 1, -1) y, t = step(CL, ts) print (CL) plt.figure(dpi=100) plt.plot(t,y) plt.grid() G1 = tf([2.5], [1, 3, 2.5]) G2 = tf([2, 0], [1, 3, 2.5]) y1, t1 = step(G1, ts) y2, t2 = step(G2, ts) plt.figure(dpi=100) plt.plot(t1, y1) plt.plot(t2, y2) plt.plot(t, y) plt.grid() plt.show()