File Exchange

image thumbnail

ifilter: Interactive Fourier filter function, version 4.1

version (17.4 KB) by Tom O'Haver
Keyboard-operated interactive Fourier filter function for time-series signals.


Updated 22 Dec 2014

View Version History

View License

ifilter(x,y) or ifilter(y) or ifilter([x y]) or ry=ifilter(x,y,center,width,shape,plotmode,filtermode)
Keyboard-operated interactive Fourier filter function for time-series signal (x,y), with keyboard controls that allow you to adjust the filter parameters continuously while observing the effect on your signal dynamically. Optinal input arguments set the intital values of center frequency, filter width, shape, plotmode (1=linear; 2=semilog frequency; 3=semilog amplitude; 4=log-log) and filtermode (Band-pass,Lowpass, Highpass, Bandpass, Band-reject, Comb pass, and Comb reject). Returns the filtered signal. Press K to list keyboard commands.
T. C. O'Haver (, Version 4 adds comb pass and comb reject filter modes.
Example 1:
Example 2 uses optional input arguments to set intital values:

KEYBOARD CONTROLS when figure window is topmost:
Adjust center frequency.......Coarse: < and >
Fine: left and right cursor arrows
Adjust filter width...........Coarse: / and "
Fine: up and down cursor arrows
Filter shape..................A,Z (A more rectangular, Z more Gaussian)
Filter mode...................B=bandpass; N or R=notch (band reject); H=High-pass; L=Low-pass; C-Comb pass; V=Comb reject.
Select plot mode..............1=linear; 2=semilog frequency
3=semilog amplitude; 4=log-log
Print keyboard commands.......K Pints this list
Print filter parameters.......Q Prints input arguments: center,width,shape,plotmode,filtermode
Print current settings........T Prints list of current settings
Switch SPECTRUM X-axis scale..X switch between frequency and period x scale on POWER SPECTRA
Switch OUTPUT Y-axis scale....Y switch between fixed or variable y scale on output plot
Play output as sound..........P or Enter
Save output as .mat file......S

Cite As

Tom O'Haver (2021). ifilter: Interactive Fourier filter function, version 4.1 (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)


Great code!

However, I am having trouble submitting values for the freq and width etc. I guess that the width is just an arbitrary parameter rather than the FWHM for example. Also, if I want to have a notch filter at 10Hz, for example, what should I enter for the frequency? (10 does not seem to work)



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

Community Treasure Hunt

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

Start Hunting!