FFT Scaling of audio (Freq)

조회 수: 1 (최근 30일)
Martin Egsdal
Martin Egsdal 2015년 10월 22일
답변: Star Strider 2015년 10월 22일
Hi, im Trying to scale my axis in an FFT in matlab - im trying to analyze a sound signal where I have used bCall to cut a piece of the signal out - I have searched and tried diffrent methodes for scaling, but non have worked.
my code is:
bCall = Audio(4.0e4:5.3e4);
dt = 1/fs;
L = length(bCall);
FFTKJER = fft(bCall, fs)/L;
subplot (2,1,1);
plot(abs(FFTKJER));
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
y = filter(Hd , bCall);
FFTKJER1 = fft(y, fs)/L;
subplot (2,1,2);
plot(abs(FFTKJER1));
but my output is all wrong i have used a filter to check the result in subplot 2
The filter is a highpass with fstop1 at 1500hz and fpass at 2000hz - so i can see the fft result scaling is wrong - how do i get the true freq scale?

답변 (1개)

Star Strider
Star Strider 2015년 10월 22일
It looks as though you are not calculating and displaying your fft correctly. You need to display only the left half, and you need to calculate and include the frequency vector. The current documentation (in R2015b) is not as straightforward as that in previous versions, so see the R2015a documentation for fft here, particularly the code between the first two plot images.
Guessing here, but see if changing part of your code to this works:
FFTKJER = fft(bCall)/L;
Fv = linspace(0, 1, fix(length(FFTKJER)/2)+1)*fs/2; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
...
plot(Fv, abs(FFTKJER(Iv)));
Note: This is untested code, but should work.

카테고리

Help CenterFile Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by