How do I fourier transfrom sinc function and plot magnitude spectrum?

9 vues (au cours des 30 derniers jours)
준석 탁
준석 탁 le 30 Mai 2021
Modifié(e) : 준석 탁 le 30 Mai 2021
Hello, I'm trying to write a Python code to verify the fourier transform’s duality by transforming the following sync functions.
The given sinc function was created by fourier transforming this square pulse.
and I got this sinc funtion which is represented by np.sin(i*T/2)/(i/2)
How do I write code that transforms this sinc function to square pulse by using np.fft.fft of numpy?
By following just like this codes
fs = 10 # Sampling frequency
w = np.arange(-2 * np.pi, 2 * np.pi, 1 / fs) # frequency axis
N = len(w)
Xw = np.zeros(N)
T = 1
for i in range(-int(N/2), int(N/2)):
if i==0:
Xw[i + int(N/2)] = 1
if i!=0:
Xw[i + int(N/2)] = np.sin( i * T / 2 ) / ( i / 2 ) # CTFT coefficient

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by