I'm trying to design a Sallen-Key BPF within Matlab. With the documentation found on ti: http://www.ti.com/lit/ml/sloa088/sloa088.pdf, I studied and understood the basic.

As for the design: The center frequency of my BPF is 40kHz. Q-factor and gain at center frequency must be 1. So in matlab I've made:

Fm = 40000;
R1 = 10000
R2 = 10000
C = 10*10^-9

R = 1/(2*pi*Fm*C);

G = 1+(R2/R1);
Q = 1/(3-G);
Am = G/(3-G);

w = 2*pi*Fm;

B=[G*R*C*w 0 ]
A=[(R^2)*(C^2)*(w^2) R*C*w*(3-G) 1]
sys=tf(B,A)

bode(sys,opts);


The issue is that my resulting bodeplot is indeed showing a BPF behaviour, but not at the desired frequency. Furthermore.

Can someone explain this to me? Thanks in advance

• Where is "s" in your formulas? – Andy aka Feb 3 '16 at 10:57
• It is on vacation and now the everything turned real ;-) – Bimpelrekkie Feb 3 '16 at 11:02
• If you don't mind my asking, what is your ultimate goal? Are you doing a Matlab homework assignment, trying to learn filter design, or trying to get a filter implemented? If you are a practicing engineer trying to get a filter designed and implemented, you need a different type of answer. – user5108_Dan Feb 3 '16 at 22:34

Your formulas do not take into account that the impedance of a capacitor is complex !

What you use is:

$$Zc(f) = 1 / 2 \pi f$$

but what you should use is:

$$Zc(s) = 1 / s$$

where $$s = 2 \pi f j$$ where j makes it imaginary remember: $$j^2 = -1$$

Have a look at this page on Wikipedia where they show how to determine the transfer function in the s domain.

• s = 2 pi j F - you left the f off (sorry I didn't mean "f off" LOL) – Andy aka Feb 3 '16 at 11:02
• If you use the tf command in matlab, you can see that it places the "s" accordningly. – user3488736 Feb 3 '16 at 12:34
• But only if you tell it to because it does not do so by default, in your script it assumes the transfer function has no imaginary numbers. tf can also calculate in z domain, but you have to tell it to do so. Have a look at the examples in nl.mathworks.com/help/control/ref/tf.html – Bimpelrekkie Feb 3 '16 at 12:56