# Second-Order Low-Pass (`lowpass2`)

> Smooths a signal by removing changes faster than a corner frequency.

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

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

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

## When to use it

Use it to smooth a measurement or model a sensor or an LC filter. Use Notch Filter to remove one frequency.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `in` | signal | Signal to filter |
| `out` | signal | Filtered signal |

## Common parameters

- `f0`: Corner frequency (Default: required)
- `q`: How sharp the filter is at the corner (Default: 0.7071)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `f0` | Hz | required |  | Corner frequency |
| `q` | — | 0.7071 |  | How sharp the filter is at the corner |

_Parameter descriptions are in English in both languages._

**Use for:** Measurement filters · Sensor models · LC filter models

**Not for:** Removing one frequency → [`notch`](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/notch/) · Passing one band → [`bandpass`](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/bandpass/)

## Formulas

| Formula | Equation | Source |
|---|---|---|
| Second-order low-pass | H(s) = ω0²/(s² + (ω0/q)·s + ω0²), ω0 = 2π·f0 | Franklin, Powell & Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed. (2019), ch. 6 |
| Damping ratio | ζ = 1/(2·q) | Erickson & Maksimović, Fundamentals of Power Electronics, 3rd ed. (2020), ch. 8 (quadratic pole response) |
| -3 dB frequency | f3 = f0·√(1 - 2ζ² + √((1 - 2ζ²)² + 1)) | Ogata, Modern Control Engineering, 5th ed. (2010), ch. 7 |
| Gain at f | G = -10·log10((1 - (f/f0)²)² + (f/(f0·q))²) | Franklin, Powell & Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed. (2019), ch. 6 |

## Quick check

Inputs:

- `f0`: Corner frequency = 1k Hz, `f0`
- `q`: Quality factor = 707.1m —, `q`
- `f`: Frequency = 5k Hz

Outputs:

- `zeta`: Damping ratio = `1/(2*q)` —
- `f3db`: -3 dB frequency = `f0*sqrt(1 - 2*zeta^2 + sqrt((1 - 2*zeta^2)^2 + 1))` Hz
- `gdb`: Gain at f in dB = `-10*log10((1 - (f/f0)^2)^2 + (f/(f0*q))^2)` —

## Model logic

- The block is a Transfer Function with num ω0² and den 1, ω0/q, ω0², ω0 = 2π·f0: the DC gain is 1 and the gain at f0 is q.
- It advances by the trapezoid (Tustin) once per accepted step, which moves the corner slightly down as the step grows.
- The state starts at zero, so the output starts at 0 even when the input does not, and there is no initial-output parameter.
- The block has no direct feedthrough, and an f0 or q that is not above zero and finite is refused.

## Model

H(s) = w0² / (s² + (w0/Q)·s + w0²) with w0 = 2·pi·f0. The DC gain is 1, the gain at f0 is Q, and the response falls at 40 dB per decade above f0. The default q of 0.7071 is a Butterworth response (-3 dB at f0); a larger q peaks near f0. The block has no direct feedthrough and is integrated with the trapezoidal rule, like Transfer Function.

## Common mistakes

- f0 is in hertz, not rad/s, so a rad/s value puts the corner 6.28 times too high. Both f0 and q must be above zero.
- The solver moves the corner down a little, so keep maxStep below one twentieth of the period of f0 for about 1 percent error. Inside a feedback loop the filter adds phase lag, so count it in the loop design.

Problems rules: `compile.error`

## Datasheet and sources

There is no datasheet. f0 comes from your filter design: a measurement filter usually sits a decade above the loop crossover and below the switching ripple, and an LC filter takes it from its L and C values. Use q of 0.7071 unless you need a specific damping.

## Example

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

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