MATLAB: How to do digital filtering in Matlab with a specified cut off frequency

digital filtering

Hello all,
I am relatively new in Matlab for doing signal processing.
I have a time series of 30 min duration having the sampling frequency of 10 Hz. So I have 18000 points in the time series and and the highest resolvable frequency of 5Hz. Now in order to avoid the high frequency noise , I want to eliminate all the frequency above 2 Hz using the FFT.
In order to do that shall I take the FFT of the time-series in Matlab and then put zero for all the complex coefficients above 2 Hz and then take the Inverse FFT of that? Will by doing this I will eliminate all the frequency contribution above 2 Hz?
Please help me in this regard. Thanks to all in advance.

Best Answer

Filtering in the frequency domain is not the optimal method because you have to filter the entire (both sides) of the symmetrical fft. It is relatively easy to do the filtering in the time domain using the Signal Processing Toolbox. This is my filter design and implementation procedure: How to design a lowpass filter for ocean wave data in Matlab?. If you do not have the Signal Processing Toolbox, the University of York (U.K.) interactive Butterworth / Bessel / Chebyshev Filters filter design page is the best available substitute I’ve found. Use the core MATLAB filter function if you don’t have the Signal Processing Toolbox filtfilt function.