#Figure 5.22 import numpy as np import matplotlib.pyplot as plt import doc_func as df th = 1000 kd = 2.5 * 10**6 w = np.logspace(-4, 5, 1000) s = 1j * w def G(s): return kd / (1 + th * s) def Gd(s): return (-2 * kd) / (1 + th * s) freqrespG = [G(si) for si in s] freqrespGd = [Gd(si) for si in s] func_list = [[np.abs(freqrespG), '-'], [np.abs(freqrespGd), '-'], [np.ones(len(w)), 'r-.']] plt.vlines(2500, 10**(-2), 1, color='m', linestyle='dashed') df.setup_bode_plot('|G| and |Gd| Value over Frequency', w, func_list, legend=('G', 'Gd', 'Gain Value of 1', 'wd'))
import matplotlib.pyplot as plt import doc_func as df w = np.linspace(0.001, 6, 1000) s = 1j * w def L1(s): return 2 / (s * (s + 1)) def L2(s): return L1(s) * ((5 - s) / (s + 5)) def S1(s): return 1 / (L1(s) + 1) def S2(s): return 1 / (L2(s) + 1) freqrespS1 = np.abs(list(map(S1, s))) freqrespS2 = np.abs(list(map(S2, s))) func_list = [[freqrespS1, '-'], [freqrespS2, '-'], [np.ones(len(w)), 'r-.']] df.setup_bode_plot('|S1| and |S2| Value over Frequency', w, func_list, ('S1', 'S2', 'Gain Value of 1'), plt.semilogy)
@author: Irshad """ from __future__ import division #Figure 5.22 import numpy as np import matplotlib.pyplot as plt import doc_func as df th = 1000 kd = 2.5 * 10**6 w = np.logspace(-4, 5, 1000) s = 1j*w def G(s): return kd/(1 + th * s) def Gd(s): return (-2 * kd)/(1 + th * s) freqrespG = [G(si) for si in s] freqrespGd = [Gd(si) for si in s] func_list = [[np.abs(freqrespG), '-'], [np.abs(freqrespGd), '-'], [np.ones(len(w)), 'r-.']] plt.vlines(2500, 10**(-2), 1, color='m', linestyle='dashed') df.setup_bode_plot('|G| and |Gd| Value over Frequency', w, func_list, legend=('G', 'Gd', 'Gain Value of 1', 'wd'))
# -*- coding: utf-8 -*- """ Created on Tue Jun 04 00:41:19 2013 @author: Irshad """ #Figure 8.16 import numpy as np import matplotlib.pyplot as plt import doc_func as df w = np.logspace(-3, 2, 1000) s = 1j * w Wi = (s + 0.2) / (0.5 * s + 1) Wp = (s / 2 + 0.05) / s func_list = [[np.abs(Wi), '-'], [np.abs(Wp), '-'], [np.ones(len(w)), 'r-.']] df.setup_bode_plot('Weight Values over Frequency', w, func_list, legend=('Wi', 'Wp', 'Gain Value of 1'))
# -*- coding: utf-8 -*- """ Created on Tue Jun 04 00:41:19 2013 @author: Irshad """ #Figure 8.16 import numpy as np import matplotlib.pyplot as plt import doc_func as df w = np.logspace(-3, 2, 1000) s = 1j*w Wi = (s + 0.2)/(0.5*s + 1) Wp = (s/2 + 0.05)/s func_list = [[np.abs(Wi), '-'], [np.abs(Wp), '-'], [np.ones(len(w)), 'r-.']] df.setup_bode_plot('Weight Values over Frequency', w, func_list, legend=('Wi', 'Wp', 'Gain Value of 1'))
w = np.linspace(0.001, 6, 1000) s = 1j * w def L1(s): return 2/(s * (s + 1)) def L2(s): return L1(s) * ((5 - s)/(s + 5)) def S1(s): return 1/(L1(s) + 1) def S2(s): return 1/(L2(s) + 1) freqrespS1 = np.abs(list(map(S1, s))) freqrespS2 = np.abs(list(map(S2, s))) func_list = [[freqrespS1, '-'], [freqrespS2, '-'], [np.ones(len(w)), 'r-.']] df.setup_bode_plot('|S1| and |S2| Value over Frequency', w, func_list, ('S1', 'S2', 'Gain Value of 1'), plt.semilogy)