DSPRelated.com
Forums

Filter Order in Analog and Digital

Started by glid...@hotmail.com March 21, 2005
Hi,
   Is the order of a Digital filter the same as of an Analog filter?? If not
why?? How do I go about designing a Digital filter for a Linkwitz Riley, 4th
order (24db/octave) or a Butterworth 2nd order (12db/octave)??

Thanks
-Glidden
	
Glidden-

>    Is the order of a Digital filter the same as of
an Analog filter??
> If not why?? How do I go about designing a Digital filter for a
> Linkwitz Riley, 4th order (24db/octave) or a Butterworth 2nd order
> (12db/octave)??

This page:

  http://stereophile.com/interviews/136/index2.html

says:

  "A fourth-order Linkwitz-Riley filter is essentially two 12dB/octave
   Butterworth filters in series with one another, which produces the
   specified 24dB/octave roll-off."

which implies you could use MATLAB, Hypersignal or some other filter design
software
to create the required Butterworth filters.

-Jeff

Glidden-

>      Yes I understand a L-R filter is a cascade of
2 2nd order Butterworth
> filters, But is a 2nd order analog Butterwoth filter the same as a 2nd
order
> Digital Butterworth filter?? People keep saying that the order of a digital
> filter is a function of the sampling frequency and the cutoff frequency in
> addition to the slope.
> 
>    I have tried creating a 2nd order butterworth filter in mathlab using a
> butterord(wp, ws, rp, rs) to get the order and the cuttoff frequency, then
> using butter(order, cutoff frequency) to get the coefficients.
> 
>    Using wpU, ws, rp=3, rs, butterord came back with an order of 2,
> like expected. However, when I plot the response of the filter, it is far
> from that of an analog 2nd order resonse. The response seems to sag and the
> slope is not a straight line.

The response should not "sag"; I've attached a freq response for
a 4th order
Butterworth with sampling rate 50 kHz and bandwidth about 1 kHz to give you some
idea.

Please post your MATLAB freq response some place where we can see it, and we can
see
what you mean about differing from the analog response.  That would be a good
starting point for people on the group to help you.

Thanks.

-Jeff

> >From: Jeff Brower <jbrower@jbro...>
> >To: Glidden Martin <gliddenmartin@glid...>
> >CC: audiodsp@audi...
> >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> >Date: Mon, 21 Mar 2005 09:33:06 -0600
> >
> >Glidden-
> >
> > >    Is the order of a Digital filter the same as of an Analog
filter??
> > > If not why?? How do I go about designing a Digital filter for a
> > > Linkwitz Riley, 4th order (24db/octave) or a Butterworth 2nd
order
> > > (12db/octave)??
> >
> >This page:
> >
> >   http://stereophile.com/interviews/136/index2.html
> >
> >says:
> >
> >   "A fourth-order Linkwitz-Riley filter is essentially two
12dB/octave
> >    Butterworth filters in series with one another, which produces the
> >    specified 24dB/octave roll-off."
> >
> >which implies you could use MATLAB, Hypersignal or some other filter
design
> >software
> >to create the required Butterworth filters.
> >
> >-Jeff
Jeff's example frequency response plot is log magnitude ("dB") against LINEAR frequency from 0 to Fs/2. This is also what MATLAB typically does, say, using freqz with log magnitude. A typical analog frequency response is plotted with a log/log format, i.e. the frequency axis is also logarithmic, so a "constant" slope expressed in dB/octave or dB/decade is a straight line. 
 
However, a digital filter can never match an analog filter of the same order exactly because the digital filter's frequency response is periodic with period Fs, whereas the analog filter's is "infinite" (or down into the noise, anyway). The straight-line slope of a Butterworth will tend to get steeper as it gets near to the zero at the Nyquist frequency Fs/2. For most applications, this is fine, but if you need a better approximation of the analog filter, you could use the Yule-Walker method with a higher order digital filter. This allows you to approximate an arbitrary frequency response. Or you could use a very high sample rate relative to your cut-off.
 
Mark
-----Original Message-----
From: Jeff Brower [mailto:j...@signalogic.com]
Sent: Monday, March 21, 2005 7:59 PM
To: Glidden Martin
Cc: a...@yahoogroups.com
Subject: Re: [audiodsp] Filter Order in Analog and Digital

Glidden-

>      Yes I understand a L-R filter is a cascade of 2 2nd order Butterworth
> filters, But is a 2nd order analog Butterwoth filter the same as a 2nd order
> Digital Butterworth filter?? People keep saying that the order of a digital
> filter is a function of the sampling frequency and the cutoff frequency in
> addition to the slope.
>
>    I have tried creating a 2nd order butterworth filter in mathlab using a
> butterord(wp, ws, rp, rs) to get the order and the cuttoff frequency, then
> using butter(order, cutoff frequency) to get the coefficients.
>
>    Using wpU, ws, rp=3, rs, butterord came back with an order of 2,
> like expected. However, when I plot the response of the filter, it is far
> from that of an analog 2nd order resonse. The response seems to sag and the
> slope is not a straight line.

The response should not "sag"; I've attached a freq response for a 4th order
Butterworth with sampling rate 50 kHz and bandwidth about 1 kHz to give you some
idea.

Please post your MATLAB freq response some place where we can see it, and we can see
what you mean about differing from the analog response.  That would be a good
starting point for people on the group to help you.

Thanks.

-Jeff

> >From: Jeff Brower <j...@signalogic.com>
> >To: Glidden Martin <g...@hotmail.com>
> >CC: a...@yahoogroups.com
> >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> >Date: Mon, 21 Mar 2005 09:33:06 -0600
> >
> >Glidden-
> >
> > >    Is the order of a Digital filter the same as of an Analog filter??
> > > If not why?? How do I go about designing a Digital filter for a
> > > Linkwitz Riley, 4th order (24db/octave) or a Butterworth 2nd order
> > > (12db/octave)??
> >
> >This page:
> >
> >   http://stereophile.com/interviews/136/index2.html
> >
> >says:
> >
> >   "A fourth-order Linkwitz-Riley filter is essentially two 12dB/octave
> >    Butterworth filters in series with one another, which produces the
> >    specified 24dB/octave roll-off."
> >
> >which implies you could use MATLAB, Hypersignal or some other filter design
> >software
> >to create the required Butterworth filters.
> >
> >-Jeff


NEW!  You can now post a message or access and search the archives of this group on DSPRelated.com:
http://www.dsprelated.com/groups/audiodsp/1.php

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

Archives:  http://www.dsprelated.com/groups/audiodsp/1.php

To Post:  Send an email to a...@yahoogroups.com

Other DSP Related Groups: http://www.dsprelated.com/groups.php
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to D...@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.


Glidden-

>      Thanks for you email. In the figure, I see
the slope (coming down on
> the right side) change, just like mine (it just looks like a sag) !!! I
will
> sent you the output soon.

I suggest to make a screen capture and include with your post to the group. 
Note: 
use .jpg format, otherwise Yahoo Groups will say the attachment is too large.

>      So what you are saying is that the order of
an analog and a digital
> filter are the same which is the same as the number of taps!!! The sampling
> frequency and the cutoff frequency are of no consequence.

No I did not say that.  Analog-to-digital mappings like bilinear transform
attempt to
approximate -- but necessarily preserve exactly -- the filter order (see
Mark's
expert post).  With the bilinear transform, at high frequencies near the
"digital
edge" (Nyquist rate, or Fs/2) approximation errors increase, so you might
expect your
filter orders to mismatch if you are designing, for example, a high-pass with
cut-off
frequency just under Fs/2.  Also the term 'taps' is typically used for
FIR filters,
and in that case is the same as 'number of coefficients', or filter
order.  For IIR
filters the 'number of coefficients' filter order are not the same
(there are
typically 5 coefficients for every order = 2).

Here is an interesting discussion that compares analog vs. digital filters:

  http://www.innerlighttheory.com/ch21.pdf

Filter order is not really a concern once you leap from one domain to the other
(see
Dr. Smith's comments about filter "speed").  You end up comparing
things like maximum
bandwidth of an op-amp vs. Intel native assembly instructions -- not much sense
to do
that.

-Jeff

> >From: Jeff Brower <jbrower@jbro...>
> >To: Glidden Martin <gliddenmartin@glid...>
> >CC: audiodsp@audi...
> >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> >Date: Mon, 21 Mar 2005 18:51:25 -0600
> >
> >Glidden-
> >
> > >      Yes I understand a L-R filter is a cascade of 2 2nd order
> >Butterworth
> > > filters, But is a 2nd order analog Butterwoth filter the same as
a 2nd
> >order
> > > Digital Butterworth filter?? People keep saying that the order of
a
> >digital
> > > filter is a function of the sampling frequency and the cutoff
frequency
> >in
> > > addition to the slope.
> > >
> > >    I have tried creating a 2nd order butterworth filter in
mathlab using
> >a
> > > butterord(wp, ws, rp, rs) to get the order and the cuttoff
frequency,
> >then
> > > using butter(order, cutoff frequency) to get the coefficients.
> > >
> > >    Using wpU, ws, rp=3, rs, butterord came back with an order
of
> >2,
> > > like expected. However, when I plot the response of the filter,
it is
> >far
> > > from that of an analog 2nd order resonse. The response seems to
sag and
> >the
> > > slope is not a straight line.
> >
> >The response should not "sag"; I've attached a freq
response for a 4th
> >order
> >Butterwidth with sampling rate 50 kHz and width about 1 kHz to give you
> >some idea.
> >
> >Please post your freq response some place where we can see it, and see
what
> >you mean
> >about differing from the analog response.  That would be a good
starting
> >point for
> >people on the group to help you.
> >
> >Thanks.
> >
> >-Jeff
> >
> > > >From: Jeff Brower <jbrower@jbro...>
> > > >To: Glidden Martin <gliddenmartin@glid...>
> > > >CC: audiodsp@audi...
> > > >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> > > >Date: Mon, 21 Mar 2005 09:33:06 -0600
> > > >
> > > >Glidden-
> > > >
> > > > >    Is the order of a Digital filter the same as of an
Analog
> >filter??
> > > > > If not why?? How do I go about designing a Digital
filter for a
> > > > > Linkwitz Riley, 4th order (24db/octave) or a
Butterworth 2nd order
> > > > > (12db/octave)??
> > > >
> > > >This page:
> > > >
> > > >   http://stereophile.com/interviews/136/index2.html
> > > >
> > > >says:
> > > >
> > > >   "A fourth-order Linkwitz-Riley filter is essentially
two 12dB/octave
> > > >    Butterworth filters in series with one another, which
produces the
> > > >    specified 24dB/octave roll-off."
> > > >
> > > >which implies you could use MATLAB, Hypersignal or some other
filter
> >design
> > > >software
> > > >to create the required Butterworth filters.
> > > >
> > > >-Jeff
> ><< butter_4th_order_filter_response.bmp >>

Glidden-

>      Thanks for you email. In the figure, I see
the slope (coming down on
> the right side) change, just like mine (it just looks like a sag) !!! I
will
> sent you the output soon.

I suggest to make a screen capture and include with your post to the group. 
Note: 
use .jpg format, otherwise Yahoo Groups will say the attachment is too large.

>      So what you are saying is that the order of
an analog and a digital
> filter are the same which is the same as the number of taps!!! The sampling
> frequency and the cutoff frequency are of no consequence.

No I did not say that.  Analog-to-digital mappings like bilinear transform
attempt to
approximate -- but necessarily preserve exactly -- the filter order (see
Mark\'s
expert post).  With the bilinear transform, at high frequencies near the
"digital
edge" (Nyquist rate, or Fs/2) approximation errors increase, so you might
expect your
filter orders to mismatch if you are designing, for example, a high-pass with
cut-off
frequency just under Fs/2.  Also the term \'taps\' is typically used
for FIR filters,
and in that case is the same as \'number of coefficients\', or filter
order.  For IIR
filters the \'number of coefficients\' filter order are not the same
(there are
typically 5 coefficients for every order = 2).

Here is an interesting discussion that compares analog vs. digital filters:

  http://www.innerlighttheory.com/ch21.pdf

Filter order is not really a concern once you leap from one domain to the other
(see
Dr. Smith\'s comments about filter "speed").  You end up
comparing things like maximum
bandwidth of an op-amp vs. Intel native assembly instructions -- not much sense
to do
that.

-Jeff

> >From: Jeff Brower <jbrower@jbro...>
> >To: Glidden Martin <gliddenmartin@glid...>
> >CC: audiodsp@audi...
> >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> >Date: Mon, 21 Mar 2005 18:51:25 -0600
> >
> >Glidden-
> >
> > >      Yes I understand a L-R filter is a cascade of 2 2nd order
> >Butterworth
> > > filters, But is a 2nd order analog Butterwoth filter the same as
a 2nd
> >order
> > > Digital Butterworth filter?? People keep saying that the order of
a
> >digital
> > > filter is a function of the sampling frequency and the cutoff
frequency
> >in
> > > addition to the slope.
> > >
> > >    I have tried creating a 2nd order butterworth filter in
mathlab using
> >a
> > > butterord(wp, ws, rp, rs) to get the order and the cuttoff
frequency,
> >then
> > > using butter(order, cutoff frequency) to get the coefficients.
> > >
> > >    Using wpU, ws, rp=3, rs, butterord came back with an order
of
> >2,
> > > like expected. However, when I plot the response of the filter,
it is
> >far
> > > from that of an analog 2nd order resonse. The response seems to
sag and
> >the
> > > slope is not a straight line.
> >
> >The response should not "sag"; I\'ve attached a freq
response for a 4th
> >order
> >Butterwidth with sampling rate 50 kHz and width about 1 kHz to give you
> >some idea.
> >
> >Please post your freq response some place where we can see it, and see
what
> >you mean
> >about differing from the analog response.  That would be a good
starting
> >point for
> >people on the group to help you.
> >
> >Thanks.
> >
> >-Jeff
> >
> > > >From: Jeff Brower <jbrower@jbro...>
> > > >To: Glidden Martin <gliddenmartin@glid...>
> > > >CC: audiodsp@audi...
> > > >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> > > >Date: Mon, 21 Mar 2005 09:33:06 -0600
> > > >
> > > >Glidden-
> > > >
> > > > >    Is the order of a Digital filter the same as of an
Analog
> >filter??
> > > > > If not why?? How do I go about designing a Digital
filter for a
> > > > > Linkwitz Riley, 4th order (24db/octave) or a
Butterworth 2nd order
> > > > > (12db/octave)??
> > > >
> > > >This page:
> > > >
> > > >   http://stereophile.com/interviews/136/index2.html
> > > >
> > > >says:
> > > >
> > > >   "A fourth-order Linkwitz-Riley filter is essentially
two 12dB/octave
> > > >    Butterworth filters in series with one another, which
produces the
> > > >    specified 24dB/octave roll-off."
> > > >
> > > >which implies you could use MATLAB, Hypersignal or some other
filter
> >design
> > > >software
> > > >to create the required Butterworth filters.
> > > >
> > > >-Jeff
> ><< butter_4th_order_filter_response.bmp >>

Glidden-

>      Thanks for you email. In the figure, I see
the slope (coming down on
> the right side) change, just like mine (it just looks like a sag) !!! I
will
> sent you the output soon.

I suggest to make a screen capture and include with your post to the group. 
Note: 
use .jpg format, otherwise Yahoo Groups will say the attachment is too large.

>      So what you are saying is that the order of
an analog and a digital
> filter are the same which is the same as the number of taps!!! The sampling
> frequency and the cutoff frequency are of no consequence.

No I did not say that.  Analog-to-digital mappings like bilinear transform
attempt to
approximate -- but necessarily preserve exactly -- the filter order (see
Mark\\\'s
expert post).  With the bilinear transform, at high frequencies near the
"digital
edge" (Nyquist rate, or Fs/2) approximation errors increase, so you might
expect your
filter orders to mismatch if you are designing, for example, a high-pass with
cut-off
frequency just under Fs/2.  Also the term \\\'taps\\\' is typically
used for FIR filters,
and in that case is the same as \\\'number of coefficients\\\', or
filter order.  For IIR
filters the \\\'number of coefficients\\\' filter order are not the
same (there are
typically 5 coefficients for every order = 2).

Here is an interesting discussion that compares analog vs. digital filters:

  http://www.innerlighttheory.com/ch21.pdf

Filter order is not really a concern once you leap from one domain to the other
(see
Dr. Smith\\\'s comments about filter "speed").  You end up
comparing things like maximum
bandwidth of an op-amp vs. Intel native assembly instructions -- not much sense
to do
that.

-Jeff

> >From: Jeff Brower <jbrower@jbro...>
> >To: Glidden Martin <gliddenmartin@glid...>
> >CC: audiodsp@audi...
> >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> >Date: Mon, 21 Mar 2005 18:51:25 -0600
> >
> >Glidden-
> >
> > >      Yes I understand a L-R filter is a cascade of 2 2nd order
> >Butterworth
> > > filters, But is a 2nd order analog Butterwoth filter the same as
a 2nd
> >order
> > > Digital Butterworth filter?? People keep saying that the order of
a
> >digital
> > > filter is a function of the sampling frequency and the cutoff
frequency
> >in
> > > addition to the slope.
> > >
> > >    I have tried creating a 2nd order butterworth filter in
mathlab using
> >a
> > > butterord(wp, ws, rp, rs) to get the order and the cuttoff
frequency,
> >then
> > > using butter(order, cutoff frequency) to get the coefficients.
> > >
> > >    Using wpU, ws, rp=3, rs, butterord came back with an order
of
> >2,
> > > like expected. However, when I plot the response of the filter,
it is
> >far
> > > from that of an analog 2nd order resonse. The response seems to
sag and
> >the
> > > slope is not a straight line.
> >
> >The response should not "sag"; I\\\'ve attached a freq
response for a 4th
> >order
> >Butterwidth with sampling rate 50 kHz and width about 1 kHz to give you
> >some idea.
> >
> >Please post your freq response some place where we can see it, and see
what
> >you mean
> >about differing from the analog response.  That would be a good
starting
> >point for
> >people on the group to help you.
> >
> >Thanks.
> >
> >-Jeff
> >
> > > >From: Jeff Brower <jbrower@jbro...>
> > > >To: Glidden Martin <gliddenmartin@glid...>
> > > >CC: audiodsp@audi...
> > > >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> > > >Date: Mon, 21 Mar 2005 09:33:06 -0600
> > > >
> > > >Glidden-
> > > >
> > > > >    Is the order of a Digital filter the same as of an
Analog
> >filter??
> > > > > If not why?? How do I go about designing a Digital
filter for a
> > > > > Linkwitz Riley, 4th order (24db/octave) or a
Butterworth 2nd order
> > > > > (12db/octave)??
> > > >
> > > >This page:
> > > >
> > > >   http://stereophile.com/interviews/136/index2.html
> > > >
> > > >says:
> > > >
> > > >   "A fourth-order Linkwitz-Riley filter is essentially
two 12dB/octave
> > > >    Butterworth filters in series with one another, which
produces the
> > > >    specified 24dB/octave roll-off."
> > > >
> > > >which implies you could use MATLAB, Hypersignal or some other
filter
> >design
> > > >software
> > > >to create the required Butterworth filters.
> > > >
> > > >-Jeff
> ><< butter_4th_order_filter_response.bmp >>

Glidden,
 
Some comments on filter order, impulse invariant vs. bilinear transform
methods, Linkwitz-Riley:
 
Filter Order:
The filter order is the number of poles (roots of the denominator of the
transfer function).  It is the same for the digital filter and its analog
prototype.  The order is not the same as the number of coefficients,
however.  For example, a 2 pole analog low pass Butterworth maps to a z
domain transfer function with 2 poles, and 1 zero (root of the numerator) if
the impulse invariant method is used.  Therefore there are 3 coefficients in
the impulse invariant digital implementation; not 2.  The same analog filter
maps to a z domain transfer function with 2 poles and 2 zeros using the
bilinear z transformation (BZT).  Therefore there are 4 coefficients in the
BZT implementation; not 2.  In both cases the order of the filter is 2.
 
Impulse Invariant Method:
The impulse invariant method yields a frequency response (both magnitude and
phase) that very closely matches the frequency response of the analog
prototype, as long as the frequency is considerably lower that the Nyquist
frequency (Fsample/2).  Time domain responses are also very closely matched.
Since the input to the impulse invariant filter must be band limited to
avoid aliasing distortion, it is not possible to implement a high pass or
band stop filter using this method.  Low pass and band pass filters can be
implemented using the impulse invariant method.
 
Biliear Transform (BZT) Method:
Because of the frequency warping that occurs in the BZT, the amplitude
frequency responses are matched at only one frequency.  Above this frequency
(for a low pass filter), the attenuation of the digital filter will be
greater than that of the analog prototype.  Phase responses and time domain
responses do not match (not even close).  Step response overshoots are
generally greater for the BZT filter than for the corresponding impulse
invariant filter.
 
Regarding the Linkwitz-Riley filter:
I'm probably telling you something that you already know:  The
Linkwitz-Riley provides a reasonable compromise between phase matching and
amplitude matching in a speaker crossover network at the crossover
frequency.  The only linear filter that provides perfect matching of both
phase and amplitude is the first order lead/first order lag combination.  
 
I hope this helps.
 
Regards,
Jon

  _____  

From: Jeff Brower [mailto:jbrower@jbro...] 
Sent: Tuesday, March 22, 2005 1:40 PM
To: Glidden Martin
Cc: audiodsp@audi...
Subject: Re: [audiodsp] Filter Order in Analog and Digital
	Glidden-

>      Thanks for you email. In the figure, I see
the slope (coming down on
> the right side) change, just like mine (it just looks like a sag) !!! I
will
> sent you the output soon.

I suggest to make a screen capture and include with your post to the group.
Note: 
use .jpg format, otherwise Yahoo Groups will say the attachment is too
large.

>      So what you are saying is that the order of
an analog and a digital
> filter are the same which is the same as the number of taps!!! The
sampling
> frequency and the cutoff frequency are of no
consequence.

No I did not say that.  Analog-to-digital mappings like bilinear transform
attempt to
approximate -- but necessarily preserve exactly -- the filter order (see
Mark's
expert post).  With the bilinear transform, at high frequencies near the
"digital
edge" (Nyquist rate, or Fs/2) approximation errors increase, so you might
expect your
filter orders to mismatch if you are designing, for example, a high-pass
with cut-off
frequency just under Fs/2.  Also the term 'taps' is typically used for
FIR
filters,
and in that case is the same as 'number of coefficients', or filter
order.
For IIR
filters the 'number of coefficients' filter order are not the same
(there
are
typically 5 coefficients for every order = 2).

Here is an interesting discussion that compares analog vs. digital filters:

  http://www.innerlighttheory.com/ch21.pdf
<http://www.innerlighttheory.com/ch21.pdf> 

Filter order is not really a concern once you leap from one domain to the
other (see
Dr. Smith's comments about filter "speed").  You end up comparing
things
like maximum
bandwidth of an op-amp vs. Intel native assembly instructions -- not much
sense to do
that.

-Jeff

> >From: Jeff Brower <jbrower@jbro...>
> >To: Glidden Martin <gliddenmartin@glid...>
> >CC: audiodsp@audi...
> >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> >Date: Mon, 21 Mar 2005 18:51:25 -0600
> >
> >Glidden-
> >
> > >      Yes I understand a L-R filter is a cascade of 2 2nd order
> >Butterworth
> > > filters, But is a 2nd order analog Butterwoth filter the same as
a 2nd
> >order
> > > Digital Butterworth filter?? People keep saying that the order of
a
> >digital
> > > filter is a function of the sampling frequency and the cutoff
frequency
> >in
> > > addition to the slope.
> > >
> > >    I have tried creating a 2nd order butterworth filter in
mathlab
using
> >a
> > > butterord(wp, ws, rp, rs) to get the order and the cuttoff
frequency,
> >then
> > > using butter(order, cutoff frequency) to get the coefficients.
> > >
> > >    Using wpU, ws, rp=3, rs, butterord came back with an order
of
> >2,
> > > like expected. However, when I plot the response of the filter,
it is
> >far
> > > from that of an analog 2nd order resonse. The response seems to
sag
and
> >the
> > > slope is not a straight line.
> >
> >The response should not "sag"; I've attached a freq
response for a 4th
> >order
> >Butterwidth with sampling rate 50 kHz and width about 1 kHz to give you
> >some idea.
> >
> >Please post your freq response some place where we can see it, and see
what
> >you mean
> >about differing from the analog response.  That would be a good
starting
> >point for
> >people on the group to help you.
> >
> >Thanks.
> >
> >-Jeff
> >
> > > >From: Jeff Brower <jbrower@jbro...>
> > > >To: Glidden Martin <gliddenmartin@glid...>
> > > >CC: audiodsp@audi...
> > > >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> > > >Date: Mon, 21 Mar 2005 09:33:06 -0600
> > > >
> > > >Glidden-
> > > >
> > > > >    Is the order of a Digital filter the same as of an
Analog
> >filter??
> > > > > If not why?? How do I go about designing a Digital
filter for a
> > > > > Linkwitz Riley, 4th order (24db/octave) or a
Butterworth 2nd order
> > > > > (12db/octave)??
> > > >
> > > >This page:
> > > >
> > > >   http://stereophile.com/interviews/136/index2.html
<http://stereophile.com/interviews/136/index2.html> 
> > > >
> > > >says:
> > > >
> > > >   "A fourth-order Linkwitz-Riley filter is essentially
two
12dB/octave
> > > >    Butterworth filters in series
with one another, which produces
the
> > > >    specified 24dB/octave
roll-off."
> > > >
> > > >which implies you could use MATLAB, Hypersignal or some other
filter
> >design
> > > >software
> > > >to create the required Butterworth filters.
> > > >
> > > >-Jeff
> ><< butter_4th_order_filter_response.bmp >>
	*	To <http://docs.yahoo.com/info/terms/> .
	
Hi,
    I think Mark hit the nail on the head when he said that the freq scale 
is linear and hence I noticed the sag. I went back and simulated an analog 
LR filter in Circuit maker and if I made the frequency scale linear I 
noticed a similar sag.

    "The Scientist and Engineer's Guide to Digital Signal
Processing". 
Chapter 21 also mentiones the log versus linear frequency scale.

    For the sake of completness I was finally able to capture the mathlab 
frequency response. I am attaching it here.

     So I guess, just to reiterate, I need to use a similar order while 
designing a digital filter as an analog filter if I am trying to replicate 
an analog filter in digital domain.

Thanks everyone

-Glidden Martin
	>From: Jeff Brower <jbrower@jbro...>
>To: Glidden Martin <gliddenmartin@glid...>
>CC: audiodsp@audi...
>Subject: Re: [audiodsp] Filter Order in Analog and Digital
>Date: Tue, 22 Mar 2005 12:39:40 -0600
>
>Glidden-
>
> >      Thanks for you email. In the figure, I see the slope (coming down

>on
> > the right side) change, just like mine (it just looks like a sag) !!!
I 
>will
> > sent you the output soon.
>
>I suggest to make a screen capture and include with your post to the group. 
>  Note:
>use .jpg format, otherwise Yahoo Groups will say the attachment is too 
>large.
>
> >      So what you are saying is that the order of an analog and a
digital
> > filter are the same which is the same as the number of taps!!! The 
>sampling
> > frequency and the cutoff frequency are of no consequence.
>
>No I did not say that.  Analog-to-digital mappings like bilinear transform 
>attempt to
>approximate -- but necessarily preserve exactly -- the filter order (see 
>Mark's
>expert post).  With the bilinear transform, at high frequencies near the 
>"digital
>edge" (Nyquist rate, or Fs/2) approximation errors increase, so you
might 
>expect your
>filter orders to mismatch if you are designing, for example, a high-pass 
>with cut-off
>frequency just under Fs/2.  Also the term 'taps' is typically used
for FIR 
>filters,
>and in that case is the same as 'number of coefficients', or
filter order.  
>For IIR
>filters the 'number of coefficients' filter order are not the same
(there 
>are
>typically 5 coefficients for every order = 2).
>
>Here is an interesting discussion that compares analog vs. digital filters:
>
>   http://www.innerlighttheory.com/ch21.pdf
>
>Filter order is not really a concern once you leap from one domain to the 
>other (see
>Dr. Smith's comments about filter "speed").  You end up
comparing things 
>like maximum
>bandwidth of an op-amp vs. Intel native assembly instructions -- not much 
>sense to do
>that.
>
>-Jeff
>
> > >From: Jeff Brower <jbrower@jbro...>
> > >To: Glidden Martin <gliddenmartin@glid...>
> > >CC: audiodsp@audi...
> > >Subject: Re: [audiodsp] Filter Order in Analog and Digital
> > >Date: Mon, 21 Mar 2005 18:51:25 -0600
> > >
> > >Glidden-
> > >
> > > >      Yes I understand a L-R filter is a cascade of 2 2nd
order
> > >Butterworth
> > > > filters, But is a 2nd order analog Butterwoth filter the
same as a 
>2nd
> > >order
> > > > Digital Butterworth filter?? People keep saying that the
order of a
> > >digital
> > > > filter is a function of the sampling frequency and the
cutoff 
>frequency
> > >in
> > > > addition to the slope.
> > > >
> > > >    I have tried creating a 2nd order butterworth filter in
mathlab 
>using
> > >a
> > > > butterord(wp, ws, rp, rs) to get the order and the cuttoff 
>frequency,
> > >then
> > > > using butter(order, cutoff frequency) to get the
coefficients.
> > > >
> > > >    Using wpU, ws, rp=3, rs, butterord came back with an 
>order of
> > >2,
> > > > like expected. However, when I plot the response of the
filter, it 
>is
> > >far
> > > > from that of an analog 2nd order resonse. The response seems
to sag 
>and
> > >the
> > > > slope is not a straight line.
> > >
> > >The response should not "sag"; I've attached a freq
response for a 4th
> > >order
> > >Butterwidth with sampling rate 50 kHz and width about 1 kHz to
give you
> > >some idea.
> > >
> > >Please post your freq response some place where we can see it, and
see 
>what
> > >you mean
> > >about differing from the analog response.  That would be a good 
>starting
> > >point for
> > >people on the group to help you.
> > >
> > >Thanks.
> > >
> > >-Jeff
> > >
> > > > >From: Jeff Brower <jbrower@jbro...>
> > > > >To: Glidden Martin <gliddenmartin@glid...>
> > > > >CC: audiodsp@audi...
> > > > >Subject: Re: [audiodsp] Filter Order in Analog and
Digital
> > > > >Date: Mon, 21 Mar 2005 09:33:06 -0600
> > > > >
> > > > >Glidden-
> > > > >
> > > > > >    Is the order of a Digital filter the same as of
an Analog
> > >filter??
> > > > > > If not why?? How do I go about designing a Digital
filter for a
> > > > > > Linkwitz Riley, 4th order (24db/octave) or a
Butterworth 2nd 
>order
> > > > > > (12db/octave)??
> > > > >
> > > > >This page:
> > > > >
> > > > >   http://stereophile.com/interviews/136/index2.html
> > > > >
> > > > >says:
> > > > >
> > > > >   "A fourth-order Linkwitz-Riley filter is
essentially two 
>12dB/octave
> > > > >    Butterworth filters in series with one another,
which produces 
>the
> > > > >    specified 24dB/octave roll-off."
> > > > >
> > > > >which implies you could use MATLAB, Hypersignal or some
other 
>filter
> > >design
> > > > >software
> > > > >to create the required Butterworth filters.
> > > > >
> > > > >-Jeff
> > ><< butter_4th_order_filter_response.bmp >>

You can get a log frequency axis in MatLab if you use "semilogx"
instead 
of "plot":

[B,A] = butter(N, f); % Where N is the order and f is the cut-off freq.
                       % normalised to lie in the interval [0, 1], where
                       % 1 is equalient to half the sampelfreq.
[H,W] = freqz(B,A);
semilogx(W, 20*log10(abs(H))), grid

Regards.

Glidden Martin a rit :
> Hi,
>     I think Mark hit the nail on the head when he said that the freq scale 
> is linear and hence I noticed the sag. I went back and simulated an analog 
> LR filter in Circuit maker and if I made the frequency scale linear I 
> noticed a similar sag.
> 
>     "The Scientist and Engineer's Guide to Digital Signal
Processing". 
> Chapter 21 also mentiones the log versus linear frequency scale.
> 
>     For the sake of completness I was finally able to capture the mathlab 
> frequency response. I am attaching it here.
> 
>      So I guess, just to reiterate, I need to use a similar order while 
> designing a digital filter as an analog filter if I am trying to replicate 
> an analog filter in digital domain.
> 
> Thanks everyone
> 
> -Glidden Martin
> 
> 
> 
>>From: Jeff Brower <jbrower@jbro...>
>>To: Glidden Martin <gliddenmartin@glid...>
>>CC: audiodsp@audi...
>>Subject: Re: [audiodsp] Filter Order in Analog and Digital
>>Date: Tue, 22 Mar 2005 12:39:40 -0600
>>
>>Glidden-
>>
>>
>>>     Thanks for you email. In the figure, I see the slope (coming
down 
>>
>>on
>>
>>>the right side) change, just like mine (it just looks like a sag)
!!! I 
>>
>>will
>>
>>>sent you the output soon.
>>
>>I suggest to make a screen capture and include with your post to the
group. 
>> Note:
>>use .jpg format, otherwise Yahoo Groups will say the attachment is too 
>>large.
>>
>>
>>>     So what you are saying is that the order of an analog and a
digital
>>>filter are the same which is the same as the number of taps!!! The 
>>
>>sampling
>>
>>>frequency and the cutoff frequency are of no consequence.
>>
>>No I did not say that.  Analog-to-digital mappings like bilinear
transform 
>>attempt to
>>approximate -- but necessarily preserve exactly -- the filter order (see

>>Mark's
>>expert post).  With the bilinear transform, at high frequencies near the

>>"digital
>>edge" (Nyquist rate, or Fs/2) approximation errors increase, so you
might 
>>expect your
>>filter orders to mismatch if you are designing, for example, a high-pass

>>with cut-off
>>frequency just under Fs/2.  Also the term 'taps' is typically
used for FIR 
>>filters,
>>and in that case is the same as 'number of coefficients', or
filter order.  
>>For IIR
>>filters the 'number of coefficients' filter order are not the
same (there 
>>are
>>typically 5 coefficients for every order = 2).
>>
>>Here is an interesting discussion that compares analog vs. digital
filters:
>>
>>  http://www.innerlighttheory.com/ch21.pdf
>>
>>Filter order is not really a concern once you leap from one domain to
the 
>>other (see
>>Dr. Smith's comments about filter "speed").  You end up
comparing things 
>>like maximum
>>bandwidth of an op-amp vs. Intel native assembly instructions -- not
much 
>>sense to do
>>that.
>>
>>-Jeff
>>
>>
>>>>From: Jeff Brower <jbrower@jbro...>
>>>>To: Glidden Martin <gliddenmartin@glid...>
>>>>CC: audiodsp@audi...
>>>>Subject: Re: [audiodsp] Filter Order in Analog and Digital
>>>>Date: Mon, 21 Mar 2005 18:51:25 -0600
>>>>
>>>>Glidden-
>>>>
>>>>
>>>>>     Yes I understand a L-R filter is a cascade of 2 2nd
order
>>>>
>>>>Butterworth
>>>>
>>>>>filters, But is a 2nd order analog Butterwoth filter the
same as a 
>>
>>2nd
>>
>>>>order
>>>>
>>>>>Digital Butterworth filter?? People keep saying that the
order of a
>>>>
>>>>digital
>>>>
>>>>>filter is a function of the sampling frequency and the
cutoff 
>>
>>frequency
>>
>>>>in
>>>>
>>>>>addition to the slope.
>>>>>
>>>>>   I have tried creating a 2nd order butterworth filter in
mathlab 
>>
>>using
>>
>>>>a
>>>>
>>>>>butterord(wp, ws, rp, rs) to get the order and the cuttoff 
>>
>>frequency,
>>
>>>>then
>>>>
>>>>>using butter(order, cutoff frequency) to get the
coefficients.
>>>>>
>>>>>   Using wpU, ws, rp=3, rs, butterord came back with an 
>>
>>order of
>>
>>>>2,
>>>>
>>>>>like expected. However, when I plot the response of the
filter, it 
>>
>>is
>>
>>>>far
>>>>
>>>>>from that of an analog 2nd order resonse. The response seems
to sag 
>>
>>and
>>
>>>>the
>>>>
>>>>>slope is not a straight line.
>>>>
>>>>The response should not "sag"; I've attached a
freq response for a 4th
>>>>order
>>>>Butterwidth with sampling rate 50 kHz and width about 1 kHz to
give you
>>>>some idea.
>>>>
>>>>Please post your freq response some place where we can see it,
and see 
>>
>>what
>>
>>>>you mean
>>>>about differing from the analog response.  That would be a good 
>>
>>starting
>>
>>>>point for
>>>>people on the group to help you.
>>>>
>>>>Thanks.
>>>>
>>>>-Jeff
>>>>
>>>>
>>>>>>From: Jeff Brower <jbrower@jbro...>
>>>>>>To: Glidden Martin <gliddenmartin@glid...>
>>>>>>CC: audiodsp@audi...
>>>>>>Subject: Re: [audiodsp] Filter Order in Analog and
Digital
>>>>>>Date: Mon, 21 Mar 2005 09:33:06 -0600
>>>>>>
>>>>>>Glidden-
>>>>>>
>>>>>>
>>>>>>>   Is the order of a Digital filter the same as of
an Analog
>>>>
>>>>filter??
>>>>
>>>>>>>If not why?? How do I go about designing a Digital
filter for a
>>>>>>>Linkwitz Riley, 4th order (24db/octave) or a
Butterworth 2nd 
>>
>>order
>>
>>>>>>>(12db/octave)??
>>>>>>
>>>>>>This page:
>>>>>>
>>>>>>  http://stereophile.com/interviews/136/index2.html
>>>>>>
>>>>>>says:
>>>>>>
>>>>>>  "A fourth-order Linkwitz-Riley filter is
essentially two 
>>
>>12dB/octave
>>
>>>>>>   Butterworth filters in series with one another, which
produces 
>>
>>the
>>
>>>>>>   specified 24dB/octave roll-off."
>>>>>>
>>>>>>which implies you could use MATLAB, Hypersignal or some
other 
>>
>>filter
>>
>>>>design
>>>>
>>>>>>software
>>>>>>to create the required Butterworth filters.
>>>>>>
>>>>>>-Jeff
>>>>
>>>><< butter_4th_order_filter_response.bmp >>
> 
> 
> 
> 
> 
> 
> 
> 
>  
> 
> 
> 
>