# L6-2_cruise.py - cruise control calculations for xferfcn lecture # RMM, 6 Nov 2012 import control import matplotlib.pyplot as plt # Define parameters for the system a = -0.01 b = 1.32 bg = 9.8 # System dynamics P = control.tf([b], [1, -a]) # Define parameters for the controller kp = 0.5 ki = 0.1 # Controller dynamics C = control.tf([kp, ki], [1, 0]) # Transfer functions Her = 1/(1 + P*C) Hed = (bg/b) * P / (1 + P*C) Hyr = P*C / (1 + P*C) # Bode plots plt.figure(1); control.bode(Hed) plt.figure(2); control.bode(Hyr) plt.figure(3); control.bode(Her)