Splitting a fouriertransform in low, middle and high frequency intervals

9 views (last 30 days)
Hi everybody.
I'm having some problems with a project I need to do for school. We have to make an analyzer for noise. We have to record some sound samples, and than do a fouriertransform of it, so that we can see the frequencies of the sound. That's working fine, but than the next step is to split the frequency spectrum into 3 intervals
  • 1 with the low frequencies: 0-255 Hz
  • 1 with the middle frequencies: 256Hz - 2kHz
  • 1 with the higher frequencies 2KHz or higher.
So far this is my code. I used most of the code from this example.
clear all
clc
Fs = 4000; % Sampling frequency
T = 1/Fs; % Sample time
L = 1000; % Length of signal
t = (0:L-1)*T; % Time vector
% Record your voice for 5 seconds.
recObj = audiorecorder(Fs, 24, 1);
recordblocking(recObj,5);
disp('End of Recording.');
% Store data in double-precision array.
myRecording = getaudiodata(recObj);
FFT = 2^nextpow2(L); % Next power of 2 from length of y
fourier = fft(myRecording);
Y = fft(myRecording,FFT)/L;
f = Fs/2*linspace(0,1,FFT/2+1);
%Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:FFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
axis([20 Inf -Inf Inf])
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
And this is an image from my plot when i let tones play of 500Hz, 800Hz and 1k5Hz
So that's working well
But I've no idea how I could split those things into intervals..
I don't want the whole solution, just a little push in the back, so I know what I've to do, so i can work on it again. Because now I'm just searching on the web for help or hints, with no result.
Help would be really appreciated :)

Accepted Answer

Wayne King
Wayne King on 23 Dec 2013
Edited: Wayne King on 23 Dec 2013
The key is to figure out the frequency spacing in the DFT, that uses simply what you are calling
FFT = 2^nextpow2(L);
and the sampling frequency.
By the way, FFT is a bad variable name. You shouldn't name a variable FFT, how about NFFT?
Assuming you name the variable NFFT, the frequency spacing is
Fs/NFFT
Now you know your frequency increments and you should be able to roughly divide up your one-sided Y vector accordingly.

More Answers (1)

Sammie
Sammie on 24 Dec 2013
Thanks, I was able to solve it now :)

Categories

Find more on Get Started with 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!