필터 지우기
필터 지우기

How to take frequency samples and time interval to plot fft in MATLAB?

조회 수: 2 (최근 30일)
Payal Arora
Payal Arora 2013년 7월 24일
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개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by