def test_nichols(tsys, mplcleanup): """Generate a Nichols plot.""" nichols_plot(tsys)
import control import matplotlib.pyplot as plt num = [0, 0, 2, 18] den = [1, 15, 54, 2] #Transfer function GH = num/den G = control.tf(num, den) control.nichols_plot(G) plt.grid(True) plt.scatter(-180, 0, s=40) plt.annotate("-180,0dB", (-180, 0)) plt.scatter(180, 0, s=40) plt.annotate("(180,0dB)", (180, 0)) plt.title('Nichols Chart') plt.xlabel('Phase(deg) ') plt.ylabel('Gain(dB)') plt.show() #if using termux plt.savefig('./figs/es17btech11009_5.pdf') plt.savefig('./figs/es17btech11009_5.eps') subprocess.run(shlex.split("termux-open ./figs/es17btech11009_5.pdf")) #else #plt.show()
#!/usr/bin/env python from control import tf from control import bode from control import nyquist_plot from control import gangof4 from control import nichols_plot import matplotlib.pyplot as plt if __name__=="__main__": # fixme: adding one by one buggy sys_tf = tf([2.], [1., 3]) sys_tf1 = tf([20.], [1., 3]) sys_tf2 = tf([200.], [10., 3]) #real, imag, freq = nichols_plot([sys_tf, sys_tf1]) #nichols_plot(sys_tf2) # mag, phase, omega = bode(sys_tf) # fixme: plot spec bounds # fixme: gui? #plt.clf() # plt.plot(mag, omega) plt.show()