FFT on a segment of a signal

조회 수: 6 (최근 30일)
tanlc
tanlc 2011년 2월 5일
hi, i am trying to analyse a signal in a .wav file by performing FFT on the signal. however i only want to perform the FFT on a particular segment of the signal at the range around the maximum point of the signal. have tried google-ing around for help on the code to segment out the signal but cant seem to work. can anyone guide mi on this?
  댓글 수: 1
Andreas Goser
Andreas Goser 2011년 2월 5일
There are 2 aspects of your code - findinf a maximum and the doing the fft. Without an example, it is difficult to say what fails.

댓글을 달려면 로그인하십시오.

채택된 답변

José Goulart
José Goulart 2011년 2월 5일
Function findpeaks() finds all the local maxima on your data. After that you would have to find the largest of the points returned.
In this case, if you just want to take the neighbourhood around the maximum point of the data, it is simpler to use max() function.
First note that, as your data is an audio signal, you should call it passing absolute values of your data as argument in order to consider both positive and negative peaks.
Here is the code:
>> abdata = abs(DataArray);
>> [mx,pmx] = max(DataArray);
>> N = 1024; %for instance
>> dataToFFT = DataArray(pmx-N:pmx+N-1);
After that, just compute the FFT normally.
  댓글 수: 1
tanlc
tanlc 2011년 2월 5일
oic. thnx!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

tanlc
tanlc 2011년 2월 5일
the following are the codes for performing FFT.
L = length(DataArray);
NFFT = 2^nextpow2(L);
FrameLength_2 = NFFT/2 ;
f = Fs/2*linspace(0,1,FrameLength_2/2+1);
Y = abs(fft(DataArray));
for the part to find the maximum, i have tried using the function findpeaks(), realmax but none seems to work.
correct me if i am wrong, how i plan to approach this is that 1. find the maximum point in the signal 2. from the maximum point, take +/- N numbers of samples to perform FFT

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by