I'm trying to find the frequency response and the DC gain, then plot the response and find the cutoff frequency from the graph.
I start off with the impulse response
$$h(t)= 1 ; 0\leqslant t\leqslant Ts$$
and my frequency response being
$$H(j\Omega)= \int_{0}^{Ts}e^{-j\Omega t}dt$$
$$=\frac{-1}{j\Omega} (1-e^{-j\Omega Ts})$$
Now, I'm having trouble with writing the code. I'm assuming something is missing but I can't figure out what exactly. What I did was define the impulse response and simply find FFT of the function, then plot it (which I'm not sure if the plot is correct). How does that help me find the DC gain or the cut-off frequency? This is a relatively new topic to me and I'm still trying to pin things down.
import numpy as np
from scipy.fftpack import fft
import matplotlib.pyplot as plt
Ts =0.001
n = np.arange(-5,7,1)
h = 1*(n>=0)*(n<=Ts)
Hr = fft(h)
plt.figure()
plt.subplot(111)
plt.plot(Hr)
plt.title('Frequency Respone of ZOH')
plt.show()