fft windowing - how to get frequency vector of one window

3 views (last 30 days)
I have wav file, I'm doing 0.1 second windowing without overlapping. I'm doing fft on each window and I need to record the mean of responses for frequencies between 2 and 3 KHZ, but I don't know how to extract responses for frequencies from 2 to 3 KHZ and average them, below is my code
fileName = 'me3.wav';
[x, fs] = audioread(fileName);
dt = 1/fs;
t = [0:length(x)-1]*dt;
figure(1);
plot(t,x);
Nfft = length(x);
f= [0 : Nfft-1 ]/Nfft*fs;
sizeOfWindow = fs*0.1; %4410 = fs*0.1
start =1;
k = 1;
while(((start+sizeOfWindow)-1)<=Nfft)
j=1;
i =start;
while(j<=sizeOfWindow)
WindowArray(j) = x(i);
j = j+1;
i = i +1;
end
Y = abs(fft(WindowArray));
%%%here I need to extract part of Y which corresponds to frequencies from 2- 3 KHZ %%%
resp(k)= mean(Y);
start = start + sizeOfWindow;
k = k+1;
end
please see my comment inside code and help me how to achieve that

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!