# Higher order Bessel filter

Started by June 22, 2007
```Can anybody give me an idea on how to implement nth order bessel filter

I am able to implement higher order Butterworth with cascaded biquads by
following equations given in the link

http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

I found that to design filter coefficients for the biquads,

Q has to be changed in the equation

Alpha = alpha = sin(w0)/(2*Q)

Q = 1/( 2*sin((pi/N)*(n + 1/2)) )

where 0 <= n < (N-1)/2

Can anybody guide me how these things can be used for designing a bessel

```
```On Fri, 22 Jun 2007 05:59:39 -0500, gangadhar.m wrote:

> Can anybody give me an idea on how to implement nth order bessel filter
>
>
> I am able to implement higher order Butterworth with cascaded biquads by
>
> following equations given in the link
>
> http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
>
> I found that to design filter coefficients for the biquads,
>
> Q has to be changed in the equation
>
> Alpha = alpha = sin(w0)/(2*Q)
>
>
> Q = 1/( 2*sin((pi/N)*(n + 1/2)) )
>
> where 0 <= n < (N-1)/2
>
> Can anybody guide me how these things can be used for designing a bessel
>
>

In the continuous-time domain a Butterworth filter has poles that trace a
half-circle in the complex plain, centered on s = 0 and evenly spaced --
which is what you get if you hold the natural frequency constant and vary
Q.  A Gaussian filter will trace a figure that is more flattened in the
imaginary direction (I don't know if it'll be elliptical or not -- it
would be interesting to find out).

To do this technique for _any_ prototype analog filter you want to break
the prototype down into "sensible" 2nd-order blocks, then do a bilinear
transformation for each block, then synthesize your 2nd-order filters in
the z domain.

I'd suggest doing a web search, looking for math that'll give you the pole
locations for a Gaussian filter of your desired order.  You should be able
to take the pole pairs and synthesize your direct-order filters from that.

--
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
```
```
Tim Wescott wrote:

>>Can anybody give me an idea on how to implement nth order bessel filter

This is not too simple.

> In the continuous-time domain a Butterworth filter has poles that trace a
> half-circle in the complex plain, centered on s = 0 and evenly spaced

The Butterworth and Chebyshev filters are specified in the terms of the
pole locations. The design of the digital cascaded filter by BLT is
straightforward. Eliptic filters are little more complex beasts, however
the approach is similar.

> which is what you get if you hold the natural frequency constant and vary
> Q.  A Gaussian filter will trace a figure that is more flattened in the
> imaginary direction (I don't know if it'll be elliptical or not -- it
> would be interesting to find out).
>
> To do this technique for _any_ prototype analog filter you want to break
> the prototype down into "sensible" 2nd-order blocks, then do a bilinear
> transformation for each block, then synthesize your 2nd-order filters in
> the z domain.

The direct BLT approach can not be used for the Bessel Filter design
from the analog prototype. The warping will produce the nonlinear phase,
thus the resultant digital filter will not be a Bessel.

The Bessel digital filter is usually done either by the impulse
invariant design or by prewarping the analog prototype. Those methods
are not very simple and do have some tradeoffs.

> I'd suggest doing a web search, looking for math that'll give you the pole
> locations for a Gaussian filter of your desired order.  You should be able
> to take the pole pairs and synthesize your direct-order filters from that.

Don't do that.

A good book which has a chapter on the Bessel IIR filter design:

Dietrich Schlichtharle. Digital Filters: Basics and Design.
Springer ISBN 3-540-66841-1

DSP and Mixed Signal Design Consultant

http://www.abvolt.com

```
```Vladimir Vassilevsky wrote:
>
>
> Tim Wescott wrote:
>
>
>>> Can anybody give me an idea on how to implement nth order bessel filter
>
> This is not too simple.
>
>>> I am able to implement higher order Butterworth with cascaded biquads
>
>> In the continuous-time domain a Butterworth filter has poles that trace a
>> half-circle in the complex plain, centered on s = 0 and evenly spaced
>
> The Butterworth and Chebyshev filters are specified in the terms of the
> pole locations. The design of the digital cascaded filter by BLT is
> straightforward. Eliptic filters are little more complex beasts, however
> the approach is similar.
>
>> which is what you get if you hold the natural frequency constant and vary
>> Q.  A Gaussian filter will trace a figure that is more flattened in the
>> imaginary direction (I don't know if it'll be elliptical or not -- it
>> would be interesting to find out).
>>
>> To do this technique for _any_ prototype analog filter you want to break
>> the prototype down into "sensible" 2nd-order blocks, then do a bilinear
>> transformation for each block, then synthesize your 2nd-order filters in
>> the z domain.
>
> The direct BLT approach can not be used for the Bessel Filter design
> from the analog prototype. The warping will produce the nonlinear phase,
> thus the resultant digital filter will not be a Bessel.
>
> The Bessel digital filter is usually done either by the impulse
> invariant design or by prewarping the analog prototype. Those methods
> are not very simple and do have some tradeoffs.
>
>
>> I'd suggest doing a web search, looking for math that'll give you the
>> pole
>> locations for a Gaussian filter of your desired order.  You should be
>> able
>> to take the pole pairs and synthesize your direct-order filters from
>> that.
>
> Don't do that.
>
> A good book which has a chapter on the Bessel IIR filter design:
>
> Dietrich Schlichtharle. Digital Filters: Basics and Design.
> Springer ISBN 3-540-66841-1
>
Although the OP may find that the approximation is good enough -- it's
hard to say without knowing what he's trying to do with his Bessel filter.

Now that we have powerful enough computers that exhaustive searches are
only exhausting for the electrons involved, I've become a big fan of
dropping a close approximation into a nonlinear optimizer, such as the
one in Scilab, and letting it do the heavy lifting.  This has served me
well for problems in robust control and curve fitting, and I suspect
it'd do fairly well for designing filters to specification.  The two big
questions you have to answer before you start are "can I gin up an
adequate cost function" and "will my algorithm avoid the local minima?".
If the answers to those questions are both "yes", then you can do a
pretty good job.

Speaking about approximations that don't work, do you know of a good
reference that gives a clean expression for a working notch filter in
the sampled-time domain?

The various approximations don't work well, because they move the zeros
around and mess up the null.  I know how to do this by direct design,
but the resulting expressions for the numerator coefficients are about
as messy as can be -- it's good enough for me, but I'd like something
that I can include in a publication for beginner or intermediate
practitioners, which means that the derivation of the numerator
coefficients should be smaller than the derivation of the propagation of

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html
```
```Tim Wescott wrote:

...

> In the continuous-time domain a Butterworth filter has poles that trace a
> half-circle in the complex plain, centered on s = 0 and evenly spaced --
> which is what you get if you hold the natural frequency constant and vary
> Q.  A Gaussian filter will trace a figure that is more flattened in the
> imaginary direction (I don't know if it'll be elliptical or not -- it
> would be interesting to find out).
>
> To do this technique for _any_ prototype analog filter you want to break
> the prototype down into "sensible" 2nd-order blocks, then do a bilinear
> transformation for each block, then synthesize your 2nd-order filters in
> the z domain.
>
> I'd suggest doing a web search, looking for math that'll give you the pole
> locations for a Gaussian filter of your desired order.  You should be able
> to take the pole pairs and synthesize your direct-order filters from that.

The consultant's eternal dilemma: give the questioner what he wants, or
give him what he wants. I wonder what properties of a Gaussian filter
the OP wants, and whether they might be more simply realized another
way. Any digital filter will match an analog prototype only at a small
fraction of the sample rate.

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```
Jerry Avins wrote:

> The consultant's eternal dilemma: give the questioner what he wants, or
> give him what he wants.

Forgive my Russian, but you probably meant "what he wants" vs "what he
is asking for" ? The answer to this dilemma is reminding yourself of who
should be the most happy in this situation :)

DSP and Mixed Signal Design Consultant

http://www.abvolt.com
```
```Vladimir Vassilevsky wrote:
>
>
> Jerry Avins wrote:
>
>
>> The consultant's eternal dilemma: give the questioner what he wants,
>> or give him what he wants.
>
> Forgive my Russian, but you probably meant "what he wants" vs "what he
> is asking for" ? The answer to this dilemma is reminding yourself of who
> should be the most happy in this situation :)
>
Perhaps it should be stated "what he wants, or what he _really_ wants".
If you're being mercenary, the best answer would be "what will make
him most likely to pay"; this may not be what he wants or needs or even
what he has asked for.  In the long run one should most likely lead him
to want what he needs to succeed, then give it to him.  That way, he'll
be happy with you, _and_ he'll have the money to cover your invoices.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html
```
```Jerry Avins wrote:

...

> The consultant's eternal dilemma: give the questioner what he wants, or
> give him what he
NEEDS.

I really have to give up decaf.

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```Vladimir Vassilevsky wrote:
>
>
> Jerry Avins wrote:
>
>
>> The consultant's eternal dilemma: give the questioner what he wants,
>> or give him what he wants.
>
> Forgive my Russian, but you probably meant "what he wants" vs "what he
> is asking for" ? The answer to this dilemma is reminding yourself of who
> should be the most happy in this situation :)

That was meant to be "The consultant's eternal dilemma: give the
questioner what he wants, or give him what he needs." I think the best
course of action involves discussion.

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```
Tim Wescott wrote:

> Now that we have powerful enough computers that exhaustive searches are
> only exhausting for the electrons involved, I've become a big fan of
> dropping a close approximation into a nonlinear optimizer, such as the
> one in Scilab, and letting it do the heavy lifting.

I am guilty of that too. Quite often a brute force is the shortest way
to a solution, and it also helps better understanding of the problem.

Not too long ago, I managed to find the closed form solution to the
system of nonlinear equations which I used to solve numerically. That
reduced the computing time from a second to several milliseconds in the
practical application. What is more important, the numerical algorithms
can go wild on the occasions, and the great care should be taken about that.

This has served me
> well for problems in robust control and curve fitting, and I suspect
> it'd do fairly well for designing filters to specification.

The high order IIR filter design by optimization is known to be
complicated. You have to define a filter in the way the stability is
guaranteed and the dependencies are continuous.

The two big
> questions you have to answer before you start are "can I gin up an
> adequate cost function" and "will my algorithm avoid the local minima?".
>   If the answers to those questions are both "yes", then you can do a
> pretty good job.

Those conditions are the strong restrictions of what you can do already;
besides, there are the ill-behaviors, the numerical problems and the
discontinuities.

> Speaking about approximations that don't work, do you know of a good
> reference that gives a clean expression for a working notch filter in
> the sampled-time domain?
> The various approximations don't work well, because they move the zeros
> around and mess up the null.  I know how to do this by direct design,
> but the resulting expressions for the numerator coefficients are about
> as messy as can be -- it's good enough for me, but I'd like something
> that I can include in a publication for beginner or intermediate
> practitioners, which means that the derivation of the numerator
> coefficients should be smaller than the derivation of the propagation of
> electromagnetic radiation from Maxwell's equations.

A basic notch is FIR with 3 taps. This looks like a simple trigonometry
problem:

fi = 2 PI Fc/Fs
A1 cos(fi) + A2 cos(2fi) = -A0
A1 sin(fi) = A2 sin(2fi) = 0

If I did not make a mistake somewhere:

A2 = A0
A1 = - 2 A0 cos(fi)