DSP lab 4 part 1 done
This commit is contained in:
@@ -4,21 +4,36 @@ import matplotlib.pyplot as plt
|
||||
N = 8
|
||||
|
||||
# Analytic DFT
|
||||
'''
|
||||
k = np.arange(N)
|
||||
W_N = np.exp(-2j*np.pi*k/N)
|
||||
plt.stem(k, -W_N)
|
||||
plt.xlabel("$k$")
|
||||
plt.ylabel("$W_N$")
|
||||
plt.show()
|
||||
'''
|
||||
|
||||
|
||||
# N=8
|
||||
n = np.arange(N)
|
||||
x = (-1.0)**n
|
||||
|
||||
# 8-point DFT, N=8
|
||||
DFT_8_point = np.fft.fft(x, 8)
|
||||
DFT_9_point = np.fft.fft(x, 9)
|
||||
|
||||
plt.stem(abs(DFT_8_point))
|
||||
plt.show()
|
||||
plt.savefig("N8_point_dft.png")
|
||||
plt.close()
|
||||
|
||||
# 9-point DFT, N=8
|
||||
DFT_9_point = np.fft.fft(x, 9)
|
||||
plt.stem(abs(DFT_9_point))
|
||||
plt.savefig("Q9_point_dft.png")
|
||||
plt.close()
|
||||
|
||||
# 9-point DFT, N=9
|
||||
N = 9
|
||||
n = np.arange(N)
|
||||
x = (-1.0)**n
|
||||
DFT_9_point = np.fft.fft(x, 9)
|
||||
plt.stem(abs(DFT_9_point))
|
||||
plt.savefig("N9_point_dft.png")
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user