FFT Scaling of audio (Freq)

1 view (last 30 days)
Martin Egsdal
Martin Egsdal on 22 Oct 2015
Answered: Star Strider on 22 Oct 2015
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?

Answers (1)

Star Strider
Star Strider on 22 Oct 2015
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.

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!