How to increase amplitude of a peak in fft in MATLAB?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello Everybody,
I am writing following code to plot fft in matlab from the ascii values. But i am getting less amplitude of the peak(as i get from the other software). How can i increase the amplitude? or is it a problem of windowing in fft? please suggest..am i doing right or wrong?
the code is following..
I = load('data1.asc');
for i = 1:2048
x = I(:,2);
end
plot(x)
Fs = 40000;
T = 1/Fs;
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)))
xlabel('Frequency (Hz)')
ylabel('Magnitude')
댓글 수: 0
답변 (1개)
Dishant Arora
2013년 7월 23일
편집: Dishant Arora
2013년 7월 24일
In the other software you might be plotting fft against indices and here you are doing it differently i.e fft vs frequency samples. you can try below mentioned code to get the desired result.
Y = abs(fft(x));
plot(y)
댓글 수: 1
Dishant Arora
2013년 7월 24일
Also you can omit the for loop, simply use:
x = I(:,2);
and there's no need for NFFT as your data length is already in powers of 2.
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!