6th Semester Files
This commit is contained in:
22
6th-Semester-Spring-2024/DSP/Labs/Lab-02/lab-02-1.py
Normal file
22
6th-Semester-Spring-2024/DSP/Labs/Lab-02/lab-02-1.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
PI = np.pi
|
||||
|
||||
|
||||
fs = 20000
|
||||
t = np.arange(0, 1, 1/fs)
|
||||
|
||||
fB = np.arange(0,2001,1)
|
||||
fC = 10000
|
||||
|
||||
m = np.zeros_like(t)
|
||||
for f in fB:
|
||||
m += np.cos(2*PI*f*t)*(-abs(f-1000)/1000 + 1)
|
||||
|
||||
c = np.cos(2*PI*fC*t)
|
||||
s = m*c
|
||||
|
||||
plt.plot(np.arange(0,fs), abs(np.fft.fft(s)))
|
||||
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user