# Variable-Frequency Second-Order Filter

Discrete-time or continuous-time variable-frequency second-order filter

**Libraries:**

Simscape /
Electrical /
Control /
General Control

## Description

The Variable-Frequency Second-Order Filter block implements four different types of second-order filters, each with external frequency input.. Filters are useful for attenuating noise in measurement signals.

The block provides these filter types:

Low pass — Allows signals, $f$, only in the range of frequencies below the cutoff frequency, ${f}_{c}$, to pass.

High pass — Allows signals, $f$, only in the range of frequencies above the cutoff frequency, ${f}_{c}$, to pass.

Band pass — Allows signals, $f$, only in the range of frequencies between two cutoff frequencies, ${f}_{c1}$ and ${f}_{c2}$, to pass.

Band stop — Prevents signals, $f$, only in the range of frequencies between two cutoff frequencies, ${f}_{c1}$ and ${f}_{c2}$, from passing.

Filter Type | Frequency Range, $f$ | |
---|---|---|

Low-Pass |
| $f<{f}_{c}$ |

High-Pass |
| $f>{f}_{c}$ |

Band-Pass |
| ${f}_{c1}<f<{f}_{c2}$ |

Band-Stop |
| ${f}_{c1}<f<{f}_{c2}$ |

### Equations

The second order derivative state equation for the filter is:

$\frac{{d}^{2}x}{d{t}^{2}}=u-2\zeta {\omega}_{n}\frac{dx}{dt}-{\omega}_{n}^{2}x$

Where:

*x*is the filter internal state.*u*is the filter input.*ω*is the filter natural frequency._{n}*ζ*is the filter damping factor.

For each filter type, the table maps the block output, $y(x)$, as a function of the internal state of the filter, to the
*s*-domain transfer function, $G(s)$.

Filter Type | Output, $y(x)$ | Transfer Function, $G(s)$ |
---|---|---|

Low-Pass | ${\omega}_{n}^{2}x$ | $\frac{{\omega}_{n}^{2}}{{s}^{2}+2\zeta {\omega}_{n}s+{\omega}_{n}^{2}}$ |

High-Pass | $\frac{{d}^{2}x}{d{t}^{2}}$ | $\frac{{s}^{2}}{{s}^{2}+2\zeta {\omega}_{n}s+{\omega}_{n}^{2}}$ |

Band-Pass | $2\zeta {\omega}_{n}\frac{dx}{dt}$ | $\frac{2\zeta {\omega}_{n}s}{{s}^{2}+2\zeta {\omega}_{n}s+{\omega}_{n}^{2}}$ |

Band-Stop | $\frac{{d}^{2}x}{d{t}^{2}}+x$ | $\frac{{s}^{2}+{\omega}_{n}^{2}}{{s}^{2}+2\zeta {\omega}_{n}s+{\omega}_{n}^{2}}$ |

For Initialization:

$\dot{x}(0)={\frac{dx}{dt}|}_{t=0}$

$u\left(0\right)={u}_{1}\left(0\right)+{u}_{2}(0)$

${u}_{1}\left(0\right)={A}_{0}{e}^{j{\phi}_{0}}$

${u}_{2}\left(0\right)={b}_{0}{e}^{j\frac{\pi}{2}}$

Where:

$x(0)$ is the initial state of the filter.

$u(0)$ is the initial input to the filter.

${u}_{1}(0)$ is the AC component of the steady-state initial input.

${A}_{0}$ is the initial amplitude.

${\phi}_{0}$ is the initial phase.

${u}_{2}(0)$ is the DC component of the steady-state initial input.

${b}_{0}$ is the initial bias.

In the *s*-domain $s=j{\omega}_{0}$. Therefore, for the initial frequency, ${\omega}_{0}$:

$\dot{x}(0)=Im\left(\frac{j{\omega}_{0}{u}_{1}\left(0\right)}{-{\omega}_{0}^{2}+j{\omega}_{0}2\zeta {\omega}_{n}+{\omega}_{n}^{2}}\right).$

$$x(0)=Im\left(\frac{\dot{x}\left(0\right){\omega}_{n}^{2}}{j{\omega}_{0}}+{u}_{2}\left(0\right)\right)$$

## Ports

### Input

### Output

## Parameters

## References

[1] Agarwal, A. and Lang, J. H.
*Foundations of Analog and Digital Electronic Circuits*. New
York: Elsevier, 2005.

## Extended Capabilities

## Version History

**Introduced in R2018b**