0% found this document useful (0 votes)
93 views

Matlab - What Is The Command For Butterworth Bandpass Filter - Stack Overflow

The document is a discussion on Stack Overflow about commands for creating Butterworth bandpass filters in MATLAB. It includes a question asking for the command to filter signal data within specific frequency bands, and an answer providing the code to create bandpass filters using the butter command or by generating filter coefficients if the signal processing toolbox is not available. The answer explains that the butter command generates coefficients that can be used to filter the input signal, and multiple filters may be combined to filter across multiple bands simultaneously.

Uploaded by

Prinlova Panda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views

Matlab - What Is The Command For Butterworth Bandpass Filter - Stack Overflow

The document is a discussion on Stack Overflow about commands for creating Butterworth bandpass filters in MATLAB. It includes a question asking for the command to filter signal data within specific frequency bands, and an answer providing the code to create bandpass filters using the butter command or by generating filter coefficients if the signal processing toolbox is not available. The answer explains that the butter command generates coefficients that can be used to filter the input signal, and multiple filters may be combined to filter across multiple bands simultaneously.

Uploaded by

Prinlova Panda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

11/13/2015

matlabwhatisthecommandforbutterworthbandpassfilterStackOverflow

signup

login

tour

help

stackoverflowcareers

Signup

StackOverflowisacommunityof4.7millionprogrammers,justlikeyou,helpingeachother.Jointhem,itonlytakesaminute:

whatisthecommandforbutterworthbandpassfilter

Ihavesignaldatatofilterusingbandpassfilterwhichthefrequenciesare1045s,45150sand150600s.howtocreatebandpassfilter
commandinmatlabtofilterthatfrequencies?
matlab

editedJun27'13at10:13

askedJun27'13at10:00

VishnuRenku

baizura

1,480

14

15

36

1 inmatlab andthequestionistaggedas PHP ?HamZaJun27'13at10:03


Sincewhenwasseconds(s)theunitoffrequency?learnvstJun27'13at10:30
Usually,a"showmethecode?"commentwouldappearhere,butIguessthisissomewhatjustifiable.
However,youcouldshowsomethingyouhavetried...icedwaterJun27'13at10:52

1Answer

Assumingyouhavethesignalprocessingtoolbox(forthe butter commandseelowercodeif


butter isunavailable),andifyouknowthesamplingfrequency fs ,youcanmakeasimple
recursiveButterworthfilterusingthelowandhighfrequency(inHz)3dBpoinsusingthe
followingcode.Higher order swillgiveyoubetterofffrequencyrejectionattheexpenseofa
longerimpulseresponseandalittlemorecomputationexpense.
[b,a]=butter(order,[lowFreqhiFreq]/(fs/2),'bandpass');
y=filter(b,a,x)

Theoutputsignal y isobtainedbyfilteringtheinputsignal
usingthe butter command.

usingthecoefficientsgenerated

Ifyouwanttohavetheoutputfromall3bandsatonce,youcansumtheoutputsfrom3separate
filteroperations,oneforeachband.However,youmayliketousethe filtfilt commandover
filter whendoingthisifyouwanttopreservethephaserelationshipbetweenthebands.
Ifyoudonothavethesignalprocessingtoolbox,youcancreate2ndorderbandpassbutterworth
coefficientsusingthecodebelow,where dt=1/fs and fl and fu arelowandhighcutoff
frequencies.
function[b,a]=butterTwoBp(dt,fl,fu)
q=pi*dt*(fufl);
r=pi*dt*(fu+fl);
N=(tan(q)^2)+sqrt(2)*tan(q)+1;
M=(tan(q)^2)/N;%MafterNbecauseitdependsonN
O=cos(r)*(2*sqrt(2)*tan(q)+4)/((cos(q))*N);
P=(2*(tan(q)^2)+(((2*cos(r))/(cos(q)))^2)+2)/N;
Q=cos(r)*(2*sqrt(2)*tan(q)4)/(cos(q)*N);
R=((tan(q)^2)sqrt(2)*tan(q)+1)/N;
b=[M02*M0M];
a=[1OPQR];

editedJun27'13at10:49

answeredJun27'13at10:31
learnvst
6,421

http://stackoverflow.com/questions/17340198/whatisthecommandforbutterworthbandpassfilter

30

65

1/2

11/13/2015

matlabwhatisthecommandforbutterworthbandpassfilterStackOverflow

http://stackoverflow.com/questions/17340198/whatisthecommandforbutterworthbandpassfilter

2/2

You might also like