# A Better Way to Think About a Notch Filter | Control Systems in Practice

From the series: Control Systems in Practice

*Brian Douglas*

This video describes an intuitive way to approach notch filter design by thinking about the problem as an inverted, lightly damped, second-order low-pass filter. Then, two additional poles are added to the resulting transfer function to make it realizable and to allow control over the width of the notch. This approach provides a little insight into how each of the terms in the transfer function contributes to the overall shape and location of the notch filter.

**Published:
4 Oct 2019**

In this video, we’re going to talk in general about band-stop filters but we’re going to focus most of our attention on a second-order notch filter. There are lots of references out there that cover what a notch filter is and how to design one, but in this video I want to approach it in a slightly different way than most of them. The goal of this video is to give you little insight about how each of the terms in a second-order band-stop filter contribute to the shape and location of the notch. That way, when you come across a transfer function in the future, maybe you’ll have a little more intuition into what it’s doing. So I hope you stick around for it. I’m Brian, and welcome to a MATLAB Tech Talk.

Band-stop filters attenuate or mostly remove a block of frequencies from a signal and pass through the other frequencies nearly unaltered. These regions are called the stop-band and the pass-bands. You may also hear them called band-reject filters, but I’m going to stay with band-stop because I like that term a little better.

Now, the width of a band-stop filter is the distance between the lowest frequency and the highest frequency blocked. And as you might expect, as filter designers, we can adjust the width of the stop-band and place it where we need to remove any troublesome frequencies in our signal.

So with that in mind, a notch filter is simply the name given to a really narrow band-stop filter. One that attempts to attenuate just a few hertz or so. Notch filters are useful if you want to filter out very specific noise. Like, for example, you can use a notch to filter out the 60Hz noise that comes from an AC power source and can show up as an audible hum in audio equipment. Or in the control world, perhaps a sensor is attached to a flexible structure and you don’t want that resonant frequency coupling through the controller, which then commands the actuators at that frequency, which might further excite the flexible mode, causing an unstable feedback loop or, at the very least, reduced performance. In this case, again, notching out that flexible structural model in your controller might help alleviate this problem.

All right, now that we kind of understand the basic idea of a notch filter and band-stop filter, let’s look at whether there is an intuitive way to think about what these filters are doing by building up the transfer function with really basic building blocks.

Commonsense would tell us that we could create a band-stop filter by combining a low-pass filter and a high pass filter together, and at first glance this makes a lot of sense. We can take a signal, pass it through a low-pass filter to keep the low frequencies, and pass it through a high-pass filter to keep the high frequencies and sum the results. This would block the batch of frequencies that don’t make it through either filter. In this case, something like 10 rad/s would be too high for the low-pass and too low for the high-pass, and therefore wouldn’t make it into the filtered signal.

This is true for an ideal filter where the stop-band perfectly attenuates a signal; however, for practical implementations this is not the case. For a first-order low-pass filter, frequencies lower than the cut-off frequency would pass through nearly unaltered, but for frequencies above the cut-off the amplitude would fall off at 20dB per decade. So frequencies are attenuated more the further away they are from the cut-off frequency. The first-order high-pass filter would be the mirror of that. It would pass through high frequencies nearly unaltered and the lower-frequency amplitudes are the ones that would fall off at 20dB per decade.

If we add the low-pass and high-pass transfer functions together and solve some of the algebra, we get a second-order band-stop transfer function and it looks similar to what I wrote out at the start of this video. And this band-stop filter that we created will produce a frequency magnitude response that looks like this V shape. So thinking of a band-stop filter as the combination of both a high-pass and low-pass filter seems to work. Easy enough. But the problem with this idea is that we don’t have control over the depth of the stop-band. The amount of attenuation with this method depends on how wide the stop-band is in the first place. As we bring the two filters closer to each other, the V in the middle becomes more shallow and this is a problem. Here, I’ll show you what I mean by plotting this in MATLAB.

I’ll build a low-pass filter with cut-off at 1rad/s and a high-pass filter with cut-off at 100 rad/s. So the band-stop width would be 2 decades, from 1 to 100.

The frequency response for this transfer function looks like what we expected, right? There is a V there and the middle of the band is attenuated by almost 35dB. But now, what happens when I move the low-pass and high-pass filters inward so that the band is between say 5 and 20 rad/s? The stop-band is still centered at 10 rad/s, but the attenuation has dropped to just about 8dB. And you can probably imagine that the attenuation will drop to almost nothing if we wanted a filter that targets a band of one or two rad/s using this method. So the concept of a low-pass filter added to a high-pass filter doesn’t hold too well for a narrow-band filter; therefore, we’re going to have to think about this differently.

Let’s start with the standard second-order low-pass filter transfer function. Wn^2 / s^2 + 2zwns + wn^2, where wn is the natural frequency and zeta is the damping ratio. This has two poles that we can move around by adjusting wn and zeta. For now, I’ll set the natural frequency to 10 rad/s, and the damping ratio to 1, which means this is a perfectly damped system and there is a double pole at s = -10. The Bode plot for this transfer function is as you might expect if you’re familiar with this already. It’s a low-pass filter with a cut-off frequency of 10 rad/s and the gain falls off at -40dB/decade. The -40 is because we have two more poles than zeros. For every extra pole, the magnitude drops by an additional -20db/decade.

Now, let’s lower the damping ratio from 1 to 0.5. The poles move closer to the imaginary axis along the constant damping line, which means there’s also an imaginary component to them. Also, the gain ever so slightly is greater than 0dB, pretty close to the natural frequency before falling off again at -40dB per decade. This means that if we input a sine wave into this system at about 7 rad/s, the amplitude of that output sine wave will be slightly larger than the input.

If we drop the damping even more to 0.1, then the peak is even higher and narrower. And if we remove the damping from this system and set zeta to 0, we get an undamped second-order transfer function. The two poles lie right on the imaginary axis and the frequency response for this system has a very narrow peak with an infinite gain right at the natural frequency. This is a system that you’d want to avoid in real life because of how grossly underdamped it is. But this is a good starting point for thinking about our notch filter. Let’s flip this response upside down by inverting the transfer function, so that instead of two poles on the imaginary axis, we’ll have two zeros and our transfer function will be s^2 + 100 / 100.

And look at that. Instead of creating a huge amount of gain at the natural frequency, we now have a system that almost completely attenuates it. That’s pretty much what we want in a notch filter. And what’s nice about this that we can adjust the damping term in the numerator to affect the depth of the notch in the same way that we adjusted it to affect the height of the peak in the inverse function.

Expect there are two problems with this transfer function: One, it’s not passing the high-frequency signals through unaltered. There is this gain that is rising at 40 dB per decade since there are two unanswered zeros. And two, it’s not a realizable transfer function because the order of the numerator is greater than the denominator. We can fix both of these problems by adding two poles to this system. Each pole will drag the high-frequency magnitude down by 20db/decade and it’ll be flat like we want. But the question is, where should we place these two poles?

Let’s open up the Control System Designer app with our transfer function, H, and use the Bode plot editor so that we can see real time how adding poles affect the frequency response. I’ll add the first pole just randomly in this high-frequency area. You can see it bent this part of the gain plot; the frequencies higher than where I placed the pole, it bent it down an additional 20dB/decade. This is because we’ve accounted for one of the extra zeros. And I can add a second pole in another random spot and see that this one also bent the gain plot down the final 20dB per decade so that the high-frequency gain is flat. However, it’s still not at 0dB, which is what we need so that the high-frequency signals are just passed through and the amplitude is not modified in any way.

Here’s how we can fix this. If I move one of the poles, you can see the gain line start to move with it and it eventually moves down to 0dB when the pole is exactly the same distance from the notch as the other pole in log space. So, say we put a pole at 100 rad/s. We need a complementary pole at 1 rad/s so that each pole is exactly one decade away from the notch, or a ratio of 10. To make the notch narrower, we can move both poles inward. In this way, we have control over the width of the notch without changing the notch location or affecting the low- and high-frequency gains.

And the transfer function math works out as well. I’ll start by defining the variable a as the ratio that each pole is away from the natural frequency so that the larger values correspond to a wider notch. Now we can create a lightly damped pair of zeros, centered at the natural frequency to get our unrealizable transfer function and the start of our notch. Then we can add a pole with cut-off frequency a times larger than the natural frequency and another pole a times smaller than the natural frequency. And what we end up with is our second-order band-stop filter. And if we plot the frequency response for this filter, you can see the characteristic V shape centered right at the natural frequency.

And this is how I like to think of a notch filter transfer function. Rather than a high-pass and low-pass filter that are added together, I think it makes more sense to think of it as a pair of undamped or very lightly damped zeros to produce the notch. The damping ratio set its depth and the natural frequency term places the center of the notch. Then we add two poles to make the system realizable and, importantly, to give us control over the width of the notch. So we can set width by adjusting a, set the depth with zeta, and move the notch around by adjusting Wn.

Okay, now that we understand how adjusting the transfer function impacts the location and shape of the stop-band, the last thing that I want to show you is that we can design a notch filter graphically within the Control System Designer app with a single click. I’ll re-launch the app with no baseline transfer function so that the magnitude and phase are both at 0. Now if I right-click in the Editor window and selection Add pole or zero, I can choose a notch filter. And click where I want to place it.

You can see in the lower left that the value of the compensator, C, is the second-order transfer function for this notch. And by grabbing the red marker, I can move the notch around and change the depth. Basically, I’m adjusting the natural frequency and the damping ratio by doing this. Then if I grab either of the two black markers, I can adjust the width of the notch. This is the same as moving the two poles around, and notice that they move together. And if you’re not into making changes graphically, you can right-click and select Edit compensator to adjust the values directly.

That’s where I’m going to leave this video. Hopefully, it’s helped a little bit to add some intuition around the notch filter transfer function. If you don’t want to miss other videos like this in the future, don’t forget to subscribe to this channel. Also, if you want to check out my channel, Control System Lectures, I cover more control theory topics there as well. Thanks for watching, and I’ll see you next time.

Seleziona un sito web

Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .

Puoi anche selezionare un sito web dal seguente elenco:

Come ottenere le migliori prestazioni del sito

Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.

Americhe

- América Latina (Español)
- Canada (English)
- United States (English)

Europa

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

Asia-Pacifico

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)