# Notch Filter (`notch`)

> Removes one frequency and lets the rest pass.

![notch](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/notch.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/control/notch/)

**Group:** Control · **Kind:** `{"block":"notch","kind":"control"}`

## When to use it

Use it to remove one known frequency, such as a mains harmonic or a mechanical resonance. Use Second-Order Low-Pass to reduce everything above a corner.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `in` | signal | Signal to filter |
| `out` | signal | Signal with one frequency removed |

## Common parameters

- `f0`: Frequency the filter blocks (Default: required)
- `q`: How narrow the blocked band is (Default: 1)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `f0` | Hz | required |  | Frequency the filter blocks |
| `q` | — | 1 |  | How narrow the blocked band is |

_Parameter descriptions are in English in both languages._

## Model

H(s) = (s² + w0²) / (s² + (w0/Q)·s + w0²) with w0 = 2·pi·f0. The gain is exactly 0 at f0 and approaches 1 at DC and at high frequency. The notch is about f0/q wide. The numerator and denominator have the same degree, so the block has direct feedthrough. It is integrated with the trapezoidal rule, like Transfer Function.

## Common mistakes

- This block passes its input straight to the output, so a loop made only of such blocks is refused. Put an Integrator or a Unit Delay in the loop.
- The solver moves the notch slightly below f0, so use a small maxStep when it must hit the target exactly. Inside a loop the notch adds phase lag below f0 and phase lead above it.

Problems rules: `compile.error`

## Datasheet and sources

There is no datasheet. f0 is the frequency to remove, measured from the waveform or taken from the plant model. A smaller q gives a wider notch, which disturbs the phase more away from f0.

## Example

Open the example with the command `file.openExample` and the name `demo:notch`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
