USE fft(x) as a highpass filter
Show older comments
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!
Accepted Answer
More Answers (5)
Rick Rosson
on 4 Aug 2011
2 votes
You are welcome. If you don't mind, could you please "Accept" the answer that helped resolve this issue?
Thanks!
Rick
Rick Rosson
on 16 Jun 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
on 17 Jun 2011
1 vote
fcarl
on 17 Jun 2011
1 Comment
Jiahao Luo
on 18 Sep 2015
I have the same issue now, did you make it work?
fcarl
on 22 Jun 2011
0 votes
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!