# Designing a Notch Filter

1. Dec 15, 2012

### ashifulk

1. The problem statement, all variables and given/known data
Need to design a second order notch filter whose transfer function is given by:
$H_a (s) = \frac{(s^2 + Ω_z^2)}{(s^2 + \frac{Ω_0}{2}s + Ω_0^2)}$
For part a (which is what I need help with) it says to assume suitable values for $Ω_0$ and $Ω_z$ with Q = 2.

3. The attempt at a solution
Honestly I have no idea how to get those two values. I need help with that part and I'm pretty sure I can finish the rest of the problem. I just want to know how I can determine those vales. The problem also gives the sampling frequency and the magnitude at f = 0 Hz, f = 10 kHz and f = 5kHz.

2. Dec 16, 2012

### aralbrec

Have a look at your transfer function. At what frequency is it going to be zero?

There is a relationship among Ωo, Q and the bandwidth of the filter that is normally a design equation but you're given a dc gain (which simply sets the constant multiplying the transfer function) and two magnitude samples at 5kHz and 10kHz. Unless those define the bandwidth, you'll have to solve the magnitude of your transfer function for Ωo at those frequencies. There is only one unknown variable left for two samples at 5kHz and 10kHz so it seems more likely those are indicating the bandwidth.

3. Dec 16, 2012

### ashifulk

Thank you for the reply. At 5kHz the mag. response is 0. At 0 Hz its 2 and at 10 kHz its unity (1). So I'm assuming the $$BW = \frac{f_0}{Q}$$ and the bandwidth in my case is 10kHz, so f_0 = 2*10k, which means $$Ω_o = 2*pi*20k$$ Am I correct? Then how do I get Ωz?

4. Dec 16, 2012

### aralbrec

Ok with the sample values, I can understand the question.

Look at that transfer function again. When is it going to be zero for s=jw? The only way is if the numerator is zero. You want this to happen when f=5kHz so this will define Ωz

The other samples will define the two other unknowns, A and Ωo. A is the constant multiplier of the transfer function that I'm adding. Without it you cannot set the dc gain arbitrarily.

$H_a (s) = \frac{A(s^2 + Ω_z^2)}{(s^2 + \frac{Ω_0}{2}s + Ω_0^2)}$

The two samples you have set |H| = 2 when s=jw=0 and |H|=1 when f=10kHz; s=jw=j2∏(10kHz). Plug them in, two equations, two unknowns.

5. Dec 16, 2012

### ashifulk

There is no A given in the problem... So can I assume it's 1 or do I have to solve for that? I solved the equations assuming A = 1 and I got two different answers. When I solved for Ωz when s=jw=0 I got the answer to be 4.4429e4 or pi*1.414e4. When I solved for Ωz when s=jw=j2∏(10kHz) I got the answer to be 20e3*∏.

Am I doing something wrong? I put in the value for Ω0 to be 10e3*∏ when solving these equations.

6. Dec 16, 2012

### aralbrec

Ωz by itself and independently of all the other parameters sets the notch frequency. It is the only way to get the gain of that transfer function to be zero at a specific frequency so when the problem says |H|=0 @ f=5kHz, Ωz is determined.

I'm going to keep the 'A' in but rename it to Ho for now and talk about that later:

$H_a (s) = \frac{H_0(s^2 + Ω_z^2)}{(s^2 + \frac{Ω_0}{2}s + Ω_0^2)}$
$|H_a(j\omega)| = \frac{|H_0||Ω_z^2 - \omega^2|}{|(Ω_0^2 - \omega^2) + j(\frac{\omega Ω_0}{2})|}$

Hopefully it is easier to see that |H| can only be zero at frequency ω if Ωz=ω. Ωz is set to determine the notch frequency. In the name, the z stands for zero :)

You now have two points that |H| must meet but only one unknown left (Ωo if we ignore Ho). This isn't possible unless the points you are given can be satisfied with Ho=1. Without the Ho you cannot independently set the dc gain and gain at some other frequency.

The general form of this type of second order filter has the Ho in there and with the points you are given, the Ho has to be there. Also notice that Ho does not change the general shape of the filter -- it only scales it.

Last edited: Dec 16, 2012
7. Dec 16, 2012

### ashifulk

I solved the equation with H0 and got four different possbilities. This was using Wolfram Alpha because Matlab was giving me a lot of errors and I didn't feel like using it, lol.

H0 = 0.0000159160, Ω0 = -0.500008
H0 = -0.0000159150, Ω0 = 0.499992
H0 = -8.01142, Ω0 = -354.744
H0 = -7.98885, Ω0 = 354.244

I'm assuming Ω0 to be positive, so that means I can't use the first and third answers. I also don't think Ω0 would be so small, so that cancels out the second answer. I'm going with the fourth answer because that seems like the correct one.

Does that make sense?

8. Dec 16, 2012

### ashifulk

I also solved the equation assuming H0 was 1 and the answers didn't match for the two points I have, so I understand what you were saying about it earlier. But I just wanted to see if that worked because that was easier to solve than two systems of equations with two unknowns, lol. And also my original problem didn't give have H0 in the transfer function.

9. Dec 16, 2012

### aralbrec

Hmm, these answers don't seem to work. For example, the easy data point given to you has |H| = 2 when f=0 (s=0):

we have Ωz = 2∏(5kHz) = 10∏×103

$|H|_{@s=0}=2=\frac{H_o \Omega_z^2}{\Omega_o^2}$
$H_o=\frac{2 \Omega_o^2}{\Omega_z^2}$

If I plug in Ω0 = 354.244, I do not get H0 = -7.98885.

Also, the magnitude function is a positive quantity so H0 is positive.

What you normally do is square the magnitude function to get rid of any square roots and then solve that. It turns into a nasty quartic and the act of squaring introduces solutions that can make the system unstable. You need to choose those solutions that make the system stable (poles in the left half plane) and preferably minimum phase (zeroes in the left half plane, though ignore that if you've never heard of that. But poles must definitely be in the LHP).

In this case, if you factor the denominator of H(s) you'll get poles at:

$s=\frac{-\frac{\Omega_o}{2}\pm\sqrt{\frac{\Omega_o^2}{4}-4\Omega_o^2}}{2}=\frac{-\frac{\Omega_o}{2}\pm j\frac{\Omega_o\sqrt{3}}{2}}{2}$

For the poles to stay in the LHP, Ωo > 0. Aside from that, if you were to try to implement this in the analogue domain with a passive circuit (L and C), both Ωo and Ωz would have to be > 0.

Last edited: Dec 17, 2012
10. Dec 18, 2012

### ashifulk

You are right aralbrec. I gave up on solving the problem. I used Matlab to solve for it and it worked, :D. Well the frequency response looked correct in Matlab. I don't have the exact values Matlab calculated because I turned in my report and forgot to save a copy. But it turns out I did need H0.