Apr-21-2017, 05:33 PM
CSV file contain a row of 1000 signals.
1. Compute the discrete fourier transform (DFT) of the signal s. Show a plot of the magnitude of the DFT.
2. Assume this signal was sampled at a rate of 44,100 Hz. How many distinct sinusoidal components are in the signal and what are the frequencies? my question here
3. Repeat the first two questions but for s1(n) = s(n)w(n) (pointwise multiplication) where w is a triangular window. Assume N = 1000.
w(n) = 1 - |(n-(N−1)/2)/(N/2)|
So, first task I did in this way:
1. Compute the discrete fourier transform (DFT) of the signal s. Show a plot of the magnitude of the DFT.
2. Assume this signal was sampled at a rate of 44,100 Hz. How many distinct sinusoidal components are in the signal and what are the frequencies? my question here
3. Repeat the first two questions but for s1(n) = s(n)w(n) (pointwise multiplication) where w is a triangular window. Assume N = 1000.
w(n) = 1 - |(n-(N−1)/2)/(N/2)|
So, first task I did in this way:
import pandas as pd import numpy as np from matplotlib import pyplot as plt tt = pd.read_csv('us-data.csv', header=None) x = tt.values[0, :] f = 2 * np.pi * (1/30.0) s1 = np.sin(f * x) S1 = np.fft.fft(s1) plt.figure(1) plt.plot(np.abs(S1)) plt.show()I don't understand the second one, not saying about the third one. Please, can you give me some hints. Maybe a little explanation of what to do.