Borrar filtros
Borrar filtros

FFT Scaling of audio (Freq)

1 visualización (últimos 30 días)
Martin Egsdal
Martin Egsdal el 22 de Oct. de 2015
Respondida: Star Strider el 22 de Oct. de 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?

Respuestas (1)

Star Strider
Star Strider el 22 de Oct. de 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.

Categorías

Más información sobre Signal Processing Toolbox en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by