Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform


Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Comp.DSP | General implementation of Butterworth filter questions

There are 7 messages in this thread.

You are currently looking at messages 0 to 7.


General implementation of Butterworth filter questions - Randall - 2010-08-29 21:07:00

Having used up 5 days already, cutting and pasting the internet source code
for Butterworth filters, only to have the audio spectrum analyzer show a
terrible mess, I have to drop back to first principles in order to get
something to work correctly.

1. I have the general Butterworth normalized polynomials for order-n (or
can generate them)  See http://en.wikipedia.org/wiki/Butterworth_filter

2. I am told to substitute for s, the value c*(z-1)/(z+1) for the bilateral
transform where c = cotangent(wc*T/2) where T is the sample time.  See
http://www.apicsllc.com/apics/Sr_3/Sr_3.htm.

This will give a rational polynomial equation in z, with the coefficients
for the difference equation.

But I am having problems getting things to work out correctly.
For wc = 1/2, T = 1 sec, and order 3, I get

B_n(3) = 1 / (s^3 + 2*s^2 + 2*s + 1)
c = cot(1/4) = 3.9131736..
s = 3.9131736*(z-1)/(z+1) and thence

       99.5744*z^3 - 200.04249*z^2 + 144.6923*z - 36.22423
H(z)   ---------------------------------------------------
                   z^3 + 3*z^2 + 3*z + 1

Which is no where close to octave's answer for the command
[b,a]=butter(3,1/2)
b = 1/6 1/2 1/2 1/6
a = 1 0 1/3 0

(we notice that sum(b) = sum(a) = 4/3

What steps am I missing to take H(z) above to match octave's answer? Or am
I misunderstanding octave's answer and misapplying it?  I am trying to
automate the answers to H(z) for any order n and cut off frequency wc.




______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: General implementation of Butterworth filter questions - Vladimir Vassilevsky - 2010-08-29 22:50:00




Randall wrote:
> Having used up 5 days already, cutting and pasting the internet source code
> for Butterworth filters, only to have the audio spectrum analyzer show a
> terrible mess, I have to drop back to first principles in order to get
> something to work correctly.

Nobody gives up good stuff for free. Butterworth filter design is 
simple: either do it yourself or pay money for someone doing it for you.

Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: General implementation of Butterworth filter questions - Rune Allnor - 2010-08-29 23:25:00

On Aug 30, 3:07=A0am, "Randall" <website.reader3@n_o_s_p_a_m.gmail.com>
wrote:
> Having used up 5 days already, cutting and pasting the internet source co=
de
> for Butterworth filters, only to have the audio spectrum analyzer show a
> terrible mess, I have to drop back to first principles in order to get
> something to work correctly.
>
> 1. I have the general Butterworth normalized polynomials for order-n (or
> can generate them) =A0Seehttp://en.wikipedia.org/wiki/Butterworth_filter
>
> 2. I am told to

Those aren't even halfway close to first principles: You have only
dug
up stuff you don't understand and accepted orders to do stuff beyond
your
abilities.

'First principles' would be to

1) Find a book on the subject
2) Read it
3) Contemplate it
4) Test the recipes and algorithms
5) Iterate items 1)-4) as many times as necessary

The question you ask is like riding a bicycle: Requires some effort
and pain to learn, but ridiculously easy once you know how.

Rune
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: General implementation of Butterworth filter questions - Steve Pope - 2010-08-29 23:30:00

Randall <website.reader3@n_o_s_p_a_m.gmail.com> wrote:

>c = cot(1/4) = 3.9131736..

I must admire you for using a slide rule in this day and age.

cot(1/4) = 3.916317364645940...


Steve
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: General implementation of Butterworth filter questions - steveu - 2010-08-29 23:38:00

>Having used up 5 days already, cutting and pasting the internet source
code
>for Butterworth filters, only to have the audio spectrum analyzer show a
>terrible mess, I have to drop back to first principles in order to get
>something to work correctly.
>
>1. I have the general Butterworth normalized polynomials for order-n (or
>can generate them)  See http://en.wikipedia.org/wiki/Butterworth_filter
>
>2. I am told to substitute for s, the value c*(z-1)/(z+1) for the
bilateral
>transform where c = cotangent(wc*T/2) where T is the sample time.  See
>http://www.apicsllc.com/apics/Sr_3/Sr_3.htm.
>
>This will give a rational polynomial equation in z, with the coefficients
>for the difference equation.
>
>But I am having problems getting things to work out correctly.
>For wc = 1/2, T = 1 sec, and order 3, I get
>
>B_n(3) = 1 / (s^3 + 2*s^2 + 2*s + 1)
>c = cot(1/4) = 3.9131736..
>s = 3.9131736*(z-1)/(z+1) and thence
>
>       99.5744*z^3 - 200.04249*z^2 + 144.6923*z - 36.22423
>H(z)   ---------------------------------------------------
>                   z^3 + 3*z^2 + 3*z + 1
>
>Which is no where close to octave's answer for the command
>[b,a]=butter(3,1/2)
>b = 1/6 1/2 1/2 1/6
>a = 1 0 1/3 0
>
>(we notice that sum(b) = sum(a) = 4/3
>
>What steps am I missing to take H(z) above to match octave's answer? Or
am
>I misunderstanding octave's answer and misapplying it?  I am trying to
>automate the answers to H(z) for any order n and cut off frequency wc.

The answer to your problem is easy as pi. :-)

Steve

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: General implementation of Butterworth filter questions - Clay - 2010-08-30 09:42:00

On Aug 29, 9:07=A0pm, "Randall" <website.reader3@n_o_s_p_a_m.gmail.com>
wrote:
> Having used up 5 days already, cutting and pasting the internet source co=
de
> for Butterworth filters, only to have the audio spectrum analyzer show a
> terrible mess, I have to drop back to first principles in order to get
> something to work correctly.
>
> 1. I have the general Butterworth normalized polynomials for order-n (or
> can generate them) =A0Seehttp://en.wikipedia.org/wiki/Butterworth_filter
>
> 2. I am told to substitute for s, the value c*(z-1)/(z+1) for the bilater=
al
> transform where c =3D cotangent(wc*T/2) where T is the sample time. =A0Se=
ehttp://www.apicsllc.com/apics/Sr_3/Sr_3.htm.
>
> This will give a rational polynomial equation in z, with the coefficients
> for the difference equation.
>
> But I am having problems getting things to work out correctly.
> For wc =3D 1/2, T =3D 1 sec, and order 3, I get
>
> B_n(3) =3D 1 / (s^3 + 2*s^2 + 2*s + 1)
> c =3D cot(1/4) =3D 3.9131736..
> s =3D 3.9131736*(z-1)/(z+1) and thence
>
> =A0 =A0 =A0 =A099.5744*z^3 - 200.04249*z^2 + 144.6923*z - 36.22423
> H(z) =A0 ---------------------------------------------------
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0z^3 + 3*z^2 + 3*z + 1
>
> Which is no where close to octave's answer for the command
> [b,a]=3Dbutter(3,1/2)
> b =3D 1/6 1/2 1/2 1/6
> a =3D 1 0 1/3 0
>
> (we notice that sum(b) =3D sum(a) =3D 4/3
>
> What steps am I missing to take H(z) above to match octave's answer? Or a=
m
> I misunderstanding octave's answer and misapplying it? =A0I am trying to
> automate the answers to H(z) for any order n and cut off frequency wc.

See if this helps:

http://www.claysturner.com/dsp/Butterworth%20Filter%20Formulae.pdf


Clay

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: General implementation of Butterworth filter questions - Nasser M. Abbasi - 2010-09-07 15:16:00

On 8/29/2010 6:07 PM, Randall wrote:
<SNIP>

Hi;

I wrote these notes for a class I took on filters this spring. If you 
find any errors, pls let me know:

butterworth based IIR digital filter design:

http://12000.org/my_notes/IIR_digital_filter_design/index.htm

I have list of butter lowpass normalized poly's here for up to N=20

http://12000.org/my_notes/list_of_normalized_low_pass_butterworth/index.htm

For butter analog filter design

http://12000.org/my_notes/butterworth_analog_filter_design/index.htm

hth

--Nasser



______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.