I was given the Gaussian function g(t)=(1/sqrt(pi) * t_H)e^{-(t/t_H)^2}$ with t_H=5 and t_H=15. I plotted the two functions over the interval [-50,50] with dt=10^{-3} using python. Here is my code:
# We first create the [-50, 50] interval with dt = 10^{-3}
List_1 = []
d_t = 10 ** (-3)
for i in range(100001):
a = -50 + i * d_t
List_1.append(a)
interval = np.array(List_1)
# Then we define the Gaussian function
def Gaussian(t, t_H):
return (1 / (np.sqrt(np.pi) * t_H)) * np.exp(-(t/t_H) ** 2)
# Here we compute the values of the Gaussian function at each point of [-50, 50]
List_2 = []
for t in interval:
List_2.append(Gaussian(t, 5))
tH_5 = np.array(List_2)
List_3 = []
for t in interval:
List_3.append(Gaussian(t, 15))
tH_15 = np.array(List_3)
# Graph plotting
plt.plot(interval, tH_5, label='t_H=5')
plt.plot(interval, tH_15, label='t_H=15')
plt.xlabel('t')
plt.ylabel('g')
plt.title('the graph of the Gaussian functions for t_H=5 and t_H=15')
plt.legend()
plt.show()
Then I was asked to conduct discrete fourier transformation for t_H=5 and t_H=15 and plot both of them and compare them to the graph of G(w)=e^{(-w^2 * t_H^2) / 4}$. I am stuck here. Is there any help?
I want some sample codes.