DSP Lab 2

This commit is contained in:
2024-02-23 21:42:45 -05:00
parent 2d4bbf49a4
commit c66e0cb8cc
200 changed files with 53329 additions and 320 deletions

View File

@@ -3,12 +3,35 @@ import matplotlib.pyplot as plt
PI = np.pi
f_s1 = 1
f_s2 = 2.5
f_s3 = 3
f_s4 = PI
fs = 20000
t = np.arange(0, 1, 1/fs)
t1 = np.arange(0,40,1/f_s1)
t2 = np.arange(0,40,1/f_s2)
t3 = np.arange(0,40,1/f_s3)
t4 = np.arange(0,40,1/f_s4)
x = np.cos(2*PI*t/7)
x1 = np.cos(2*PI*t1/7)
x2 = np.cos(2*PI*t2/7)
x3 = np.cos(2*PI*t3/7)
x4 = np.cos(2*PI*t4/7)
plt.plot(np.arange(0,fs), abs(np.fft.fft(s)))
plt.subplot(2,2,1)
plt.stem(t1,x1)
plt.title("1[Hz] Sampling")
plt.subplot(2,2,2)
plt.stem(t2,x2)
plt.title("2.5[Hz] Sampling")
plt.subplot(2,2,3)
plt.stem(t3,x3)
plt.title("3[Hz] Sampling")
plt.subplot(2,2,4)
plt.stem(t4,x4)
plt.title("$\pi$[Hz] Sampling")
plt.show()