7
\$\begingroup\$

I design a filter in Matlab using these command:

Fs = 2.5*10^10;
n = 2;
Wn = 5000/Fs;
[b,a] = butter(n,Wn);

and get

b={9.86988268891764e-14, 1.97397653778353e-13, 9.86988268891764e-14}
a={1, -1.99999911142341, 0.999999111423807}

How do I make the analog one?

http://en.wikipedia.org/wiki/Butterworth_filter

\$\endgroup\$

1 Answer 1

11
\$\begingroup\$

First, you probably designed your digital filter incorrectly. You used Wn = 5000/Fs, but the digital Wn parameter wants a number from 0 to 1, where 1 is Fs/2, so you'd normally say, for a 5000 Hz filter, that Wn = 5000/(Fs/2).

Assuming this is what you meant, you want to design a 2nd-order analog Butterworth lowpass filter with a cutoff frequency of 5000 Hz.

First, use [b,a] = butter(n,Wn,'s') to get the output in the analog s domain instead of the digital z domain.

[b,a] = butter(n,Wn,'s') designs an order n lowpass analog Butterworth filter with angular cutoff frequency Wn rad/s. It returns the filter coefficients in the length n+1 row vectors b and a, in descending powers of s, derived from this transfer function: enter image description here

If you want the cutoff frequency to be 5 kHz (= 2π⋅5000 radians/s), use butter(2,2*pi*5000,'s'), for instance. In GNU Octave I get:

> [b, a] = butter(2,2*pi*5000,'s')
b = 9.8696e+008
a = 1.0000e+000  4.4429e+004  9.8696e+008

So the transfer function would then be

\$H(s) = {9.8696 \times 10^8 \over {s^2 + 4.4429 \times 10^4 s + 9.8696 \times 10^8}}\$

Butterworth filters always consist of N poles arranged in a semicircle around the left side of the unit circle (and you could actually design it directly this way). This has 2 poles at -22214.4 ± 22214.4j. To make a practical filter, you group the complex conjugate pairs into 2nd-order sections and build a biquad filter for each. In your case, it's already a single 2nd-order section, so you only need one filter.

Then you map that to a circuit, like one of these: http://en.wikipedia.org/wiki/Butterworth_filter#Filter_design

enter image description here

Capacitor reactance is \$1 \over Cs\$ and inductors are \$Ls\$, so the transfer function is

\$H(s) = {Vout(s) \over Vin(s)} = {{1 \over {C1 s}} \| R2 \over {L1 s + R1 + {1 \over {C1 s}} \| R2}} = \frac{R2}{C L1 R2 s^2 + (C R1 R2 + L1) s + (R2 + R1)}\$

So

  • Numerator:
    • R2 = 9.8696e+008 Ω = 987 MΩ
  • Denominator:
    • C*L1*R2 = 1
    • C*R1*R2 + L1 = 4.4429e+004
    • R2 + R1 = 987 MΩ

So then R1 = 0 and L1 = 44.4 kH?? and C = 22.8 fF?? ...Oh man, I don't remember this stuff.

Actually... although these values are completely insane, they do work in a simulation.

So you could then scale all the values simultaneously to more reasonable ones. Multiply the capacitor by some value, and divide the inductor and resistor by the same value to keep the filter the same. For instance, multiplying by 1 million gets us into a more reasonable range:

  • C = 22.8 fF * 1000000 = 22.8 nF
  • R2 = 987 MΩ / 1000000 = 987 Ω
  • L1 = 44.4 kH / 1000000 = 44.4 mH

Hey, it works!

TINA simulation of reasonable values

Practically, though? Just use filter design software like everyone else.

\$\endgroup\$
2
  • \$\begingroup\$ @eryksun: Well yes, I would never actually do this with Matlab. Which is why I don't remember how. \$\endgroup\$
    – endolith
    Commented Jun 29, 2011 at 1:24
  • \$\begingroup\$ @eryksun Yes, but this is the simplest way to demonstrate it \$\endgroup\$
    – endolith
    Commented May 13, 2014 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.