design a filter using only fft

4 visualizzazioni (ultimi 30 giorni)
Áron Laczkovits
Áron Laczkovits il 26 Set 2012
I want to design a low pass filter without any toolboxes, only using fft. My plan is, that i read a wav file into matlab, then i fft it and i reload into a 1D vektor. I have to zeroing for example the first 100 elements. Then ifft it. Unfortunatelly doesnt work. Anyone can help me in the m code or any idea how can i do it?

Risposta accettata

Wayne King
Wayne King il 26 Set 2012
Modificato: Wayne King il 26 Set 2012
From your description it sounds like you are not also zero-ing out the complex conjugates. You are zero-ing out only the "positive" frequencies, but you also have to zero the corresponding negative frequencies. I'll illustrate this in the following example with two sine waves in noise. I'll remove the 200-Hz sine wave.
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t)+cos(2*pi*200*t)+randn(size(t));
% get rid of the 200-Hz component.
xdft = fft(x);
% 200 Hz lives at bin 201
xdft(201)
% but look at bin length(x)-201+2
xdft(length(x)-201+2)
You see the difference between those is that one is the complex conjugate of the other. You have to zero them both.
xdft([201 length(x)-201+2]) = 0;
xrec = ifft(xdft);
plot(abs(fft(xrec)))
You see now that the 200-Hz component is gone.
  2 Commenti
Áron Laczkovits
Áron Laczkovits il 26 Set 2012
Is it work with a wave signal? I mean if i use a wav file instead of the 2 sine wave.
Wayne King
Wayne King il 26 Set 2012
Yes, the principle is the same. I'm not advocating this as a way of filtering a signal, but the point is, you have to remove both the "negative" and "positive" frequencies before you take the inverse Fourier transform.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Fourier Analysis and Filtering in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by