How to take frequency samples and time interval to plot fft in MATLAB?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
i have a vector containing 2048 data(ASCII file) in this manner like [87 92 80 45 .... ]. I want to plot fft of this data. So I just want to know how to take frequency sample and time interval to plot fft of this data? I wrote the following code to calculate fft of this code. Please suggest whether the frequency sample and time interval is right or wrong? or suggest the code to calculate fft of this data.
I = load('data1.asc');
for i = 1:2048
x = I(:,2);
end
plot(x)
*Fs = 40000; * Frequency Samples
*T = 1/Fs; * Time
L = 2000;
NFFT = 2^nextpow2(L);
Y = abs(fft(x,NFFT))/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
figure, plot(f,2*abs(Y(1:NFFT/2+1)))
axis([0 40000 0 40])
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Spectral Measurements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!