File Exchange

image thumbnail

FFT filter - clean your signals and display results!

version 1.2.0.0 (2.54 KB) by Shmuel Ben-Ezra
Perform Fourier transform, filter in frequency domain, reconstruct the signal.

92 Downloads

Updated 16 Aug 2009

View License

The function introduces the implementation of fft and ifft in filtering and cleaning of signals.
The function plots
1. the original signal,
2. its transform,
3. the reconstructed (filtered) signal.
You can control the filtering by giving your parameters.
Comprehensive help is included (>>help fftf).
The code is extensively commented.

Comments and Ratings (22)

elias GR

Aitor Arana

Miguel Aznar

Awesome, Thanks

This is excellent!!! Thanks a lot

balaji reddy

Worked immediately, very nice. Thanks Shmuel.
ps: thank you Craig Doolittle for your quick input on getting non-rescaled data.

Mahabir

Works very nicely and solved the problem with minor rectification.
Reconstructed signal has problem of scaling. It needs to multiplied by length of signal. After fft, it was divided by length, which need to nullify.
Suggestions(already given by others also):
1. Plotting can be option, default off.
2. band pass, high pass option can be added.
3. raw plots instead of normalized plot to compare with original.

Why not apply a low-pass filter instead of simply setting to 0 the spectral amplitudes above the cut-off frequency?
With your technique, the result might be erroneous due to aliasing.

Otherwise, nice function.

Yu GUAN

Bravo!

Suzie Mason

Thank you for sharing! Very useful and clearly written.

Megan

Megan (view profile)

I noticed that the output signal is always plotted on a scale of -1 to +1. I take it this is always a normalized plot?

Moe Ring

Undefined function 'fftf' for input arguments of type 'double'.

I just wanted to use my signal... any suggestions?

This code is so good! I have learned a lot from you code and have simply changed it to have 3 filtering mode. Don't know how to update it in comment. Anyway, thanks for sharing this!

Fan D.Chen

Can This code be used as a bandpass filter?

Ferdi

Ferdi (view profile)

Very nice and easy to use fft-implementation. I've used this extensively for my thesis. Thanks a lot!

Alexander

Excellent code. For a mech eng, this is a godsend.
Thanks.

Justin

Justin (view profile)

Works great!

Also made the change Craig made.

Pat

Pat (view profile)

Well written code. The commenting on the lines is very much appreciated making it easier for the user to follow. Thank you very much!!

Saud

Saud (view profile)

anybody help to run this code.

I changed line 56 from:
X=X(1:N)/max(X);
to:
X=X(1:N)*N;
in order to return original scaling

This file saved me some time writing my own, thank you very much!

Very well written. Thanks a lot. It helped me so much.

Updates

1.2.0.0

included a screenshot

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor