Time-shift after fft & filter?

조회 수: 10 (최근 30일)
Shaula Garibbo
Shaula Garibbo 2020년 6월 12일
댓글: Shaula Garibbo 2020년 6월 12일
I tried to implement a simple LP filter on an audio file, but I'm slightly confused by the apparent shifting of the signal in the time domain. What have I overlooked / misunderstood? Thanks.
filename = 'Raw_Wav_20180425_000226.wav';
[y,fs] = audioread(filename);
subplot(1,2,1)
plot(t,y)
xlabel('Time (s)')
ylabel('Amplitude')
title('Raw')
fmax1 = 40; %end of pass band
fmax2 = 60; %end of transition band
nt = length(y);
t = [0:nt-1]/fs;
y = y-mean(y);
dF = fs/nt;
f = -fs/2:dF:fs/2-dF;
yft = fftshift(fft(y));
I = find(abs(f)>fmax2);
yft(I) = 0;
I = find( abs(f)>fmax1 & abs(f)<=fmax2 );
yft(I) = yft(I) .* hanning(length(I));
y = ifftshift(ifft(yft));
subplot(1,2,2)
plot(t,y)
xlabel('Time (s)')
ylabel('Amplitude')
title('Post-filter')

채택된 답변

Sugar Daddy
Sugar Daddy 2020년 6월 12일
As you have taken fft first and then fftshift, so if you want to do inverse of this, you need inverse of fftshift first as it is performed at the end. so the order of inverse must be
  1. ifftshift
  2. fft
  댓글 수: 1
Shaula Garibbo
Shaula Garibbo 2020년 6월 12일
Thank you very much!

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

추가 답변 (0개)

카테고리

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