Documente Academic
Documente Profesional
Documente Cultură
# DTFT FORMULA
x = np.ones(5)
stp = 0
X_abs = np.zeros(len(w))
X_ang = np.zeros(len(w))
for i in range(len(w)):
X_abs[i], X_ang[i] = DTFT(w[i], x, stp)
1
In [26]: plt.plot(w,X_ang)
2
In [29]: stp = 7
X_abs_2 = np.zeros(len(w))
X_ang_2 = np.zeros(len(w))
for i in range(len(w)):
X_abs_2[i], X_ang_2[i] = DTFT(w[i], x, stp)
3
In [35]: stp = -4
X_abs_2 = np.zeros(len(w))
X_ang_2 = np.zeros(len(w))
for i in range(len(w)):
X_abs_2[i], X_ang_2[i] = DTFT(w[i], x, stp)
plt.plot(w, 20*np.log10(X_abs_2))
plt.show()
plt.plot(w, X_ang_2)
4
Out[35]: [<matplotlib.lines.Line2D at 0x7f8b964ab278>]
5
1 1.4 SAME AS ABOVE QUESTION
In [40]: r = np.zeros(len(x))
for i in range(len(x)):
r[i] = (-1)**i*x[i]
plt.stem(r)
plt.show()
stp = 0
X_abs_2 = np.zeros(len(w))
X_ang_2 = np.zeros(len(w))
for i in range(len(w)):
X_abs_2[i], X_ang_2[i] = DTFT(w[i], r, stp)
plt.plot(w, 20*np.log10(X_abs_2))
plt.show()
plt.plot(w, X_ang_2)