USE fft(x) as a highpass filter
Mostrar comentarios más antiguos
Hi,
I want to use the fft(x) function to create an highpass filter. I want to ask if the following procedure is correct:
1) take the signal x and make an fft(x).
2) Set frequencies up to 0.5 Hz to zero.
3) Make ifft(spectrum).
Is it right to set the first data points to zero or is there anything to pay attention to (e.g.: symmetry of the fft...). So if I set the first data points to zero, is this enough?
Thanks for your efforts!
Respuesta aceptada
Más respuestas (5)
Rick Rosson
el 4 de Ag. de 2011
2 votos
You are welcome. If you don't mind, could you please "Accept" the answer that helped resolve this issue?
Thanks!
Rick
Rick Rosson
el 16 de Jun. de 2011
Before you can solve this problem, you need to know the sampling rate (in samples per second) of the signal x. Otherwise, you will not be able to figure out how many samples of the spectrum correspond to 0.5 hertz (the cut-off frequency).
For convenience, you may want to create the variable Fs to represent the sampling rate and Fc to repreesent the cut-off frequency. For example:
Fs = 200; % samples per second
Fc = 0.5; % hertz
Also, the spectrum returned by the fft function is double-sided. By default, it corresponds to the frequencies from 0 hertz up to Fs hertz. It will be easier to implement your filter if you swap the two halves of the spectrum, so that it will correspond to -Fs/2 up to +Fs/2. You can do so using the fftshift function:
X = fftshift(fft(x));
HTH.
Rick
David Young
el 17 de Jun. de 2011
1 voto
fcarl
el 17 de Jun. de 2011
1 comentario
Jiahao Luo
el 18 de Sept. de 2015
I have the same issue now, did you make it work?
fcarl
el 22 de Jun. de 2011
0 votos
Categorías
Más información sobre Fourier Analysis and Filtering en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!