File Exchange

image thumbnail

Easy Bandpass Filter

version (2.26 KB) by Wonsang You
Simplified band-pass filtering without external toolboxes.


Updated 14 Jul 2016

View License

It performs band-pass filtering of a time series with the rectangle window in frequency domain, "without external toolboxes". An example code is given as follows to filter a time series in the pass band of 200~300 Hz:
Fs = 1000;
t = linspace(0,1,Fs);
x = cos(2*pi*100*t)+0.5*randn(size(t));
y = bpfilt(x,200,300,1000);

Cite As

Wonsang You (2021). Easy Bandpass Filter (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (12)

Alexander S

This is technically speaking not a filter but a frequency selector in the fourier domain.

Because information is lost during transform i would not recommend using this as a filter. It is good for generating a signal with a certain spectral characteristic.

Ngoc Minh Tran

Ho Ha

Achilleas Vortselas

The amplitude changes because the spectrum calculation divides by N. Change the code to multiply the output signal by N to get the correct result.


why the amplitude change so much?

Taylor Stone

Sowjanya Mattaparthi

Sowjanya Mattaparthi



Jing Sun

why the amplitude change so much?


MATLAB Release Compatibility
Created with R2010a
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!