[Introduction]
[Signal
arithmetic] [Signals
and noise] [Smoothing]
[Differentiation]
[Peak
Sharpening] [Harmonic
analysis] [Fourier
convolution] [Fourier
deconvolution] [Fourier
filter] [Peak
area measurement] [Linear
Least Squares] [Multicomponent
Spectroscopy] [Iterative
Curve Fitting] [Hyperlinear
quantitative absorption spectrophotometry] [Appendix
and Case Studies] [Peak
Finding and Measurement] [iPeak]
[iSignal]
[Peak
Fitters] [iFilter]
[iPower]
[List
of downloadable software] [Interactive
tools]

Command-line Fourier filter function for time-series signal vector y; 'samplingtime' is the total duration of sampled signal in sec, millisec, or microsec; 'centerfrequency' and 'frequencywidth' are the center frequency and width of the filter in Hz, KHz, or MHz, respectively. If 'shape' = 1, the filter is Gaussian; as 'shape' increases, the filter shape becomes more and more rectangular (faster cut-off rate). Set 'mode' = 0 for band-pass filter, 'mode' = 1 for band-reject (notch) filter. Click here to view or download just this function.

Example: plot(FouFilter(tan(1:1000),15,2,2,0))

iFilter is a
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. Optional input arguments set
the initial values of center frequency, filter width, shape,
plotmode (1=linear; 2=semilog frequency; 3=semilog amplitude;
4=log-log) and filter mode ('band-pass', 'low-pass', 'high-pass',
'band-reject (notch), 'comb pass', and 'comb notch'). In the comb
modes, the filter has multiple bands located at frequencies 1, 2,
3, 4... times the center frequency, each with the same
(controllable) width and shape.

The filtered signal can be returned as the function value, saved
as a ".mat" file on the disk, or plays through the computer's
sound system. Press **K** to list keyboard commands.
This is a self-contained Matlab function that does not require any
toolboxes or add-on functions. Click here
to view or download and place it in the Matlab path.

At the Matlab command prompt, type: ifilter(x,y) or ifilter(y) or ifilter(xymatrix) or
ry=ifilter(x,y,center,width,shape,plotmode,filtermode)

Version 4.3, June 2016

**Example 1:**

Periodic waveform with 2 frequency components at 60 and 440
Hz.

`x=[0:.001:2*pi];
y=sin(60.*x.*2.*pi)+2.*sin(440.*x.*2.*pi);
ifilter(x,y);`

**Example 3:** Picking one frequency out of a noisy sine wave.

` ``x=[0:.01:2*pi]';`

` y=sin(20*x)+3.*randn(size(x));`

` ifilter(x,y,3.1,0.85924,15,1,'Band-pass');`

**Example 4:** Square wave with band-pass vs Comb pass filter

`t = 0:.0001:.0625;`

` y=square(2*pi*64*t);`

` ifilter(t,y,64,32,12,1,'Band-pass');``
` ifilter(t,y,48,32,2,1,'Comb
pass');

**Example
6:** This example shows a 1.58 sec duration
audio recording of the spoken phrase "Testing, one, two, three",
previously recorded at 44000 Hz and saved in WAV format (download link) and in ".mat"
format (download link), loaded into iFilter, which is initially set to bandpass
mode and tuned to a narrow segment that is *well above* the
frequency range of most of the signal. It seems as if though this
passband would miss most of the frequency components in the
signal, yet even in this case the speech is intelligible,
demonstrating the remarkable ability of the ear-brain system to
make do with a highly compromised signal. Press **P** or **space
**to hear the filter's output. Different filter settings will
change the timbre
of the sound.

`>> v=wavread('``TestingOneTwoThree.wav``');`

`>> time=0:1/44001:1.5825;`

`>> waveform=v(:,2);`

`>> ifilter(``time`,`waveform`,1267,700,10,2,'Band-pass');

iFilter 4.3 KEYBOARD
CONTROLS when figure window is topmost:

Adjust filter frequency.......Coarse (10% change): < and >

Fine (1% change): left and right cursor
arrows

Adjust filter width...........Coarse (10% change): / and "

Fine (1% change): 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 notch.

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 or **W** Prints ifilter with 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

on the horizontal axis

Switch OUTPUT Y-axis scale....Y switch output plot between fixed or

variable
vertical axis.

Play output as sound..........P or Enter

Save output as .mat file......S

This page is part of "**A
Pragmatic Introduction to Signal Processing**", created
and maintained by Prof.
Tom O'Haver , Department of Chemistry and Biochemistry, The
University of Maryland at College Park. Comments, suggestions and
questions should be directed to Prof. O'Haver at toh@umd.edu.

Last updated: March, 2018. Number of unique visits to this site since May 17, 2008: