# The code for part a is as follows: import numpy as np # for cos, abs, pi, complex conjugate, etc #https://numpy.org/doc/stable/reference/generated/numpy.conj.html?highlight=conj#numpy.conj import matplotlib.pyplot as plt #For Plotting #https://matplotlib.org/tutorials/introductory/pyplot.html w = np.arange(-5,5,.01) # Setting Step Size for w as it is not acontinuous variable. This allows us to evaluate -5

The code for part a is as follows:

import numpy as np # for cos, abs, pi, complex conjugate, etc #https://numpy.org/doc/stable/reference/generated/numpy.conj.html?highlight=conj#numpy.conj

import matplotlib.pyplot as plt #For Plotting #https://matplotlib.org/tutorials/introductory/pyplot.html

w = np.arange(-5,5,.01) # Setting Step Size for w as it is not acontinuous variable. This allows us to evaluate -5 <= w <=5

def H(w): out = np.complex(0,w) return out

def H1(w): out = 1/np.complex(0,w) return out

def magH(w): out = np.absolute(H(w)) return out

def phaseH(w): out = np.angle(H(w)) return out

def magH1(w): out = np.absolute(H1(w)) return out

def phaseH1(w): out = np.angle(H1(w)) return out

phase = np.vectorize(phaseH)

mag = np.vectorize(magH)

phase1 = np.vectorize(phaseH1)

mag1 = np.vectorize(magH1)

plt.figure("Frequency Response of Differentiator",figsize=(10,5) )

plt.suptitle('\$H(omega) = jmath omega\$')

plt.subplot(211)

plt.plot(w,mag(w))

plt.ylabel('\$|H(omega)|\$', color="blue")

plt.xlabel('\$omega\$',horizontalalignment='right', x=1.0,color="blue")

plt.yticks([2,4], color="red")

plt.xticks([-4,-2,0,2,4], color="green")

plt.grid(True)

plt.subplot(212)

plt.plot(w,phase(w))

plt.ylabel('\$Phi(omega)\$', color="blue")

plt.xlabel('\$omega\$',horizontalalignment='right', x=1.0,color="blue")

plt.yticks([-np.pi/2,0, np.pi/2],["\$-pi/2\$", 0, "\$pi/2\$"],color="red")

plt.xticks([-4,-2,0,2,4], color="green")

plt.grid(True)

plt.show() #Frequency Response

plt.figure("Frequency Response of Integrator", figsize=(10,5))

plt.suptitle('\$H(omega) =1/(jmath omega)\$')

plt.subplot(211)

plt.plot(w,mag1(w))

plt.ylabel('\$|H(omega)|\$', color="blue")

plt.xlabel('\$omega\$',horizontalalignment='right', x=1.0,color="blue")

plt.yticks([2,4], color="red")

plt.xticks([-4,-2,0,2,4], color="green")

plt.ylim(0,4)

plt.grid(True)

plt.subplot(212)

plt.plot(w,phase1(w))

plt.ylabel('\$Phi(omega)\$', color="blue")

plt.xlabel('\$omega\$',horizontalalignment='right', x=1.0,color="blue")

plt.yticks([-np.pi/2,0, np.pi/2],["\$-pi/2\$", 0, "\$pi/2\$"],color="red")

plt.xticks([-4,-2,0,2,4], color="green")

plt.grid(True)

plt.show() #Frequency Response

Related Book For

## Income Tax Fundamentals 2013

31st Edition

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

ISBN: 9781285586618