IIR-Butterworth digital bandpass filter coeeficients

Started by kerasus October 8, 2007
Hi all...

I'm new here. I found this list while searching the web for my problem.
I'm an electronics engineer, and I have to design a filter for my project.
In fact I haven't worked on DSP so much and I don't know so much about it.
But finally I wrote a code for my filter, but there is something missing:
COEFFICIENTS.  I'm not good at calculating the coefficients, they were my
nightmares at university. Anyway, I have searched the web for coefficient
calculation applets, but all of them gave different results. I'll be so
pleased if someone knows a good applet link and share it with me. Or if
someone has any other suggestions, please tell me. Here are some datas
which may be helpfull.

Type: IIR Butterworth Digital Bandpass Filter
fc1 : 0.2 Hz
fc2 : 10  Hz
fs  : 270 Hz

Hope to get some help, best regards, Mursel


On 8 Okt, 11:37, "kerasus" <murselak...@gmail.com> wrote:
> Hi all... > > I'm new here. I found this list while searching the web for my problem. > I'm an electronics engineer, and I have to design a filter for my project. > In fact I haven't worked on DSP so much and I don't know so much about it. > But finally I wrote a code for my filter, but there is something missing: > COEFFICIENTS. I'm not good at calculating the coefficients, they were my > nightmares at university. Anyway, I have searched the web for coefficient > calculation applets, but all of them gave different results.
Did any of the results match the spec?
> I'll be so > pleased if someone knows a good applet link and share it with me. Or if > someone has any other suggestions, please tell me. Here are some datas > which may be helpfull. > > Type: IIR Butterworth Digital Bandpass Filter > fc1 : 0.2 Hz > fc2 : 10 Hz > fs : 270 Hz
There is information missing: - You need to specify both stopband corners and passband corners (two of each) - You need to specify passband ripple and stopband attenuation (one of each) Rune
Thanks Rune;

I haven't mentioned in first entry, here are the informations:


>- You need to specify both stopband corners and > passband corners (two of each)
fs1 = 0.1 Hz, fs2 = 25 Hz,
>- You need to specify passband ripple and stopband > attenuation (one of each)
passband ripple = 3 dB, stopband attenuation = 40 dB, The results from the apllets didn't match the spec. May be I'm doing something wrong. I got some parameters from Matlab Digital Filter Design Toolbox. But the result is given in 5 stages (so the order is 10). I don't know how to calculate the overall coefficients from given 5 stages' nominators and denominators. Can you suggest a web page or a another way which may help me to calculate the coefficients by hand? Or how can I use these Matlab results to calculate the coefficients?
Let me write the informations more clear, my post seems so primitive, sorry
for that :)

Passband cornes      :  0.2 Hz and 10 Hz
Stopband corners     :  0.1 Hz and 25 Hz
Sampling frequency   :  270 Hz
Passband ripple      :  3 dB
Stopband attenuation :  40 dB

 
On 8 Okt, 12:36, "kerasus" <murselak...@gmail.com> wrote:
> Thanks Rune; > > I haven't mentioned in first entry, here are the informations: > > >- You need to specify both stopband corners and > > passband corners (two of each) > > fs1 = 0.1 Hz, > fs2 = 25 Hz,>- You need to specify passband ripple and stopband > > attenuation (one of each) > > passband ripple = 3 dB, > stopband attenuation = 40 dB, > > The results from the apllets didn't match the spec. May be I'm doing > something wrong. I got some parameters from Matlab Digital Filter Design > Toolbox. But the result is given in 5 stages (so the order is 10).
Given your specs, I get 6x biquads (2nd order stages). That's with my own filter design SW, so there may be a bug in there.
> I don't > know how to calculate the overall coefficients from given 5 stages' > nominators and denominators. Can you suggest a web page or a another way > which may help me to calculate the coefficients by hand? Or how can I use > these Matlab results to calculate the coefficients?
Exactly what do you have? The numerator/denominator coefficients for each biquad? The overall numerator and denominator? If the former, the overall numerator is found by multiplying the numerator polynomials, and similarly for the denominator. If you have the overall coefficients, you use a root finding routine to sove for the roots of the numerator and denominator polynomials, respectively. The coefficients for the biquads are found by combining complex conjugated roots. Rune
On Mon, 08 Oct 2007 05:36:26 -0500, kerasus wrote:

> Thanks Rune; > > I haven't mentioned in first entry, here are the informations: > > >>- You need to specify both stopband corners and >> passband corners (two of each) > fs1 = 0.1 Hz, > fs2 = 25 Hz, >>- You need to specify passband ripple and stopband >> attenuation (one of each) > passband ripple = 3 dB, > stopband attenuation = 40 dB, > > The results from the apllets didn't match the spec. May be I'm doing > > something wrong. I got some parameters from Matlab Digital Filter Design > > Toolbox. But the result is given in 5 stages (so the order is 10). I don't > > know how to calculate the overall coefficients from given 5 stages' > > nominators and denominators. Can you suggest a web page or a another way > > which may help me to calculate the coefficients by hand? Or how can I use > > these Matlab results to calculate the coefficients?
If Matlab is giving you coefficients for 5 2nd-order systems that's a good thing -- you _don't_ want to get your answer in one 10th-order polynomial. One has trouble with quantization in filters, and it gets worse with increasing order -- to the point where a 10th order filter would need an absurd level of precision in the states and the coefficients to do it's job correctly. You even run into numerical difficulty in factoring a large polynomial down into smaller ones, so getting your answer as a bunch of smaller polynomials is a good thing indeed. So be happy with your 2nd-order sets, and make a bunch of cascaded 2nd-order filters to go with them. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
>On Mon, 08 Oct 2007 05:36:26 -0500, kerasus wrote:
> >> Thanks Rune; >> >> I haven't mentioned in first entry, here are the informations: >> >> >>>- You need to specify both stopband corners and >>> passband corners (two of each) >> fs1 = 0.1 Hz, >> fs2 = 25 Hz, >>>- You need to specify passband ripple and stopband >>> attenuation (one of each) >> passband ripple = 3 dB, >> stopband attenuation = 40 dB, >> >> The results from the apllets didn't match the spec. May be I'm doing >> >> something wrong. I got some parameters from Matlab Digital Filter
Design
>> >> Toolbox. But the result is given in 5 stages (so the order is 10). I
don't
>> >> know how to calculate the overall coefficients from given 5 stages' >> >> nominators and denominators. Can you suggest a web page or a another
way
>> >> which may help me to calculate the coefficients by hand? Or how can I
use
>> >> these Matlab results to calculate the coefficients? > >If Matlab is giving you coefficients for 5 2nd-order systems that's a
good
>thing -- you _don't_ want to get your answer in one 10th-order
polynomial.
>One has trouble with quantization in filters, and it gets worse with >increasing order -- to the point where a 10th order filter would need an >absurd level of precision in the states and the coefficients to do it's >job correctly. You even run into numerical difficulty in factoring a >large polynomial down into smaller ones, so getting your answer as a
bunch
>of smaller polynomials is a good thing indeed. > >So be happy with your 2nd-order sets, and make a bunch of cascaded >2nd-order filters to go with them. > >-- >Tim Wescott >Control systems and communications consulting >http://www.wescottdesign.com > >Need to learn how to apply control theory in your embedded system? >"Applied Control Theory for Embedded Systems" by Tim Wescott >Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html >
Thank you all for your replies... I've solved my problems using Matlab function sos2tf. Now I've a pretty good wroking filter.
>On Mon, 08 Oct 2007 05:36:26 -0500, kerasus wrote:
> >> Thanks Rune; >> >> I haven't mentioned in first entry, here are the informations: >> >> >>>- You need to specify both stopband corners and >>> passband corners (two of each) >> fs1 = 0.1 Hz, >> fs2 = 25 Hz, >>>- You need to specify passband ripple and stopband >>> attenuation (one of each) >> passband ripple = 3 dB, >> stopband attenuation = 40 dB, >> >> The results from the apllets didn't match the spec. May be I'm doing >> >> something wrong. I got some parameters from Matlab Digital Filter
Design
>> >> Toolbox. But the result is given in 5 stages (so the order is 10). I
don't
>> >> know how to calculate the overall coefficients from given 5 stages' >> >> nominators and denominators. Can you suggest a web page or a another
way
>> >> which may help me to calculate the coefficients by hand? Or how can I
use
>> >> these Matlab results to calculate the coefficients? > >If Matlab is giving you coefficients for 5 2nd-order systems that's a
good
>thing -- you _don't_ want to get your answer in one 10th-order
polynomial.
>One has trouble with quantization in filters, and it gets worse with >increasing order -- to the point where a 10th order filter would need an >absurd level of precision in the states and the coefficients to do it's >job correctly. You even run into numerical difficulty in factoring a >large polynomial down into smaller ones, so getting your answer as a
bunch
>of smaller polynomials is a good thing indeed. > >So be happy with your 2nd-order sets, and make a bunch of cascaded >2nd-order filters to go with them. > >-- >Tim Wescott >Control systems and communications consulting >http://www.wescottdesign.com > >Need to learn how to apply control theory in your embedded system? >"Applied Control Theory for Embedded Systems" by Tim Wescott >Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html >
Thank you all for your replies... I've solved my problems using Matlab function sos2tf. Now I've a pretty good wroking filter.
On Mon, 08 Oct 2007 05:36:26 -0500, kerasus wrote:

> Thanks Rune; > > I haven't mentioned in first entry, here are the informations: > > >>- You need to specify both stopband corners and >> passband corners (two of each) > fs1 = 0.1 Hz, > fs2 = 25 Hz, >>- You need to specify passband ripple and stopband >> attenuation (one of each) > passband ripple = 3 dB, > stopband attenuation = 40 dB, > > The results from the apllets didn't match the spec. May be I'm doing > > something wrong. I got some parameters from Matlab Digital Filter Design > > Toolbox. But the result is given in 5 stages (so the order is 10). I don't > > know how to calculate the overall coefficients from given 5 stages' > > nominators and denominators. Can you suggest a web page or a another way > > which may help me to calculate the coefficients by hand? Or how can I use > > these Matlab results to calculate the coefficients?
If Matlab is giving you coefficients for 5 2nd-order systems that's a good thing -- you _don't_ want to get your answer in one 10th-order polynomial. One has trouble with quantization in filters, and it gets worse with increasing order -- to the point where a 10th order filter would need an absurd level of precision in the states and the coefficients to do it's job correctly. You even run into numerical difficulty in factoring a large polynomial down into smaller ones, so getting your answer as a bunch of smaller polynomials is a good thing indeed. So be happy with your 2nd-order sets, and make a bunch of cascaded 2nd-order filters to go with them. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
On 8 Okt, 12:36, "kerasus" <murselak...@gmail.com> wrote:
> Thanks Rune; > > I haven't mentioned in first entry, here are the informations: > > >- You need to specify both stopband corners and > > passband corners (two of each) > > fs1 = 0.1 Hz, > fs2 = 25 Hz,>- You need to specify passband ripple and stopband > > attenuation (one of each) > > passband ripple = 3 dB, > stopband attenuation = 40 dB, > > The results from the apllets didn't match the spec. May be I'm doing > something wrong. I got some parameters from Matlab Digital Filter Design > Toolbox. But the result is given in 5 stages (so the order is 10).
Given your specs, I get 6x biquads (2nd order stages). That's with my own filter design SW, so there may be a bug in there.
> I don't > know how to calculate the overall coefficients from given 5 stages' > nominators and denominators. Can you suggest a web page or a another way > which may help me to calculate the coefficients by hand? Or how can I use > these Matlab results to calculate the coefficients?
Exactly what do you have? The numerator/denominator coefficients for each biquad? The overall numerator and denominator? If the former, the overall numerator is found by multiplying the numerator polynomials, and similarly for the denominator. If you have the overall coefficients, you use a root finding routine to sove for the roots of the numerator and denominator polynomials, respectively. The coefficients for the biquads are found by combining complex conjugated roots. Rune
Let me write the informations more clear, my post seems so primitive, sorry
for that :)

Passband cornes      :  0.2 Hz and 10 Hz
Stopband corners     :  0.1 Hz and 25 Hz
Sampling frequency   :  270 Hz
Passband ripple      :  3 dB
Stopband attenuation :  40 dB

 
Thanks Rune;

I haven't mentioned in first entry, here are the informations:


>- You need to specify both stopband corners and > passband corners (two of each)
fs1 = 0.1 Hz, fs2 = 25 Hz,
>- You need to specify passband ripple and stopband > attenuation (one of each)
passband ripple = 3 dB, stopband attenuation = 40 dB, The results from the apllets didn't match the spec. May be I'm doing something wrong. I got some parameters from Matlab Digital Filter Design Toolbox. But the result is given in 5 stages (so the order is 10). I don't know how to calculate the overall coefficients from given 5 stages' nominators and denominators. Can you suggest a web page or a another way which may help me to calculate the coefficients by hand? Or how can I use these Matlab results to calculate the coefficients?
On 8 Okt, 11:37, "kerasus" <murselak...@gmail.com> wrote:
> Hi all... > > I'm new here. I found this list while searching the web for my problem. > I'm an electronics engineer, and I have to design a filter for my project. > In fact I haven't worked on DSP so much and I don't know so much about it. > But finally I wrote a code for my filter, but there is something missing: > COEFFICIENTS. I'm not good at calculating the coefficients, they were my > nightmares at university. Anyway, I have searched the web for coefficient > calculation applets, but all of them gave different results.
Did any of the results match the spec?
> I'll be so > pleased if someone knows a good applet link and share it with me. Or if > someone has any other suggestions, please tell me. Here are some datas > which may be helpfull. > > Type: IIR Butterworth Digital Bandpass Filter > fc1 : 0.2 Hz > fc2 : 10 Hz > fs : 270 Hz
There is information missing: - You need to specify both stopband corners and passband corners (two of each) - You need to specify passband ripple and stopband attenuation (one of each) Rune
Hi all...

I'm new here. I found this list while searching the web for my problem.
I'm an electronics engineer, and I have to design a filter for my project.
In fact I haven't worked on DSP so much and I don't know so much about it.
But finally I wrote a code for my filter, but there is something missing:
COEFFICIENTS.  I'm not good at calculating the coefficients, they were my
nightmares at university. Anyway, I have searched the web for coefficient
calculation applets, but all of them gave different results. I'll be so
pleased if someone knows a good applet link and share it with me. Or if
someone has any other suggestions, please tell me. Here are some datas
which may be helpfull.

Type: IIR Butterworth Digital Bandpass Filter
fc1 : 0.2 Hz
fc2 : 10  Hz
fs  : 270 Hz

Hope to get some help, best regards, Mursel