Main Content

Variable-Frequency Second-Order Filter

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

  • Variable-Frequency Second-Order Filter block

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, fc, to pass.

  • High pass — Allows signals, f, only in the range of frequencies above the cutoff frequency, fc, to pass.

  • Band pass — Allows signals, f, only in the range of frequencies between two cutoff frequencies, fc1 and fc2, to pass.

  • Band stop — Prevents signals, f, only in the range of frequencies between two cutoff frequencies, fc1 and fc2, from passing.

Filter TypeFrequency Range, f
Low-Pass

f<fc
High-Pass

f>fc
Band-Pass

fc1<f<fc2
Band-Stop

fc1<f<fc2

Equations

The second order derivative state equation for the filter is:

d2xdt2=u2ζωndxdtωn2x

Where:

  • x is the filter internal state.

  • u is the filter input.

  • ωn is the filter natural frequency.

  • ζ 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 TypeOutput, y(x)Transfer Function, G(s)
Low-Passωn2xωn2s2+2ζωns+ωn2
High-Passd2xdt2s2s2+2ζωns+ωn2
Band-Pass2ζωndxdt2ζωnss2+2ζωns+ωn2
Band-Stopd2xdt2+xs2+ωn2s2+2ζωns+ωn2

For Initialization:

x˙(0)=dxdt|t=0

u(0)=u1(0)+u2(0)

u1(0)=A0ejφ0

u2(0)=b0ejπ2

Where:

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

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

  • u1(0) is the AC component of the steady-state initial input.

  • A0 is the initial amplitude.

  • φ0 is the initial phase.

  • u2(0) is the DC component of the steady-state initial input.

  • b0 is the initial bias.

In the s-domain s=jω0. Therefore, for the initial frequency, ω0:

x˙(0)=Im(jω0u1(0)ω02+jω02ζωn+ωn2).

x(0)=Im(x˙(0)ωn2jω0+u2(0))

Ports

Input

expand all

Filter input.

Data Types: single | double

Natural frequency.

Data Types: single | double

Output

expand all

Filtered output.

Data Types: single | double

Parameters

expand all

Main

Type of second-order filter.

Natural frequency, in Hz, at the start of simulation.

Initial Conditions

Damping factor of the filter.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? and Specify Sample Time.

For inherited discrete-time operation, set this parameter to -1. For discrete-time operation, set this parameter to a positive integer. For continuous-time operation, set this parameter to 0.

If this block is in a masked subsystem or a variant subsystem that supports switching between continuous operation and discrete operation, promote this parameter to ensure correct switching between the continuous and discrete implementations of the block. For more information, see Promote Block Parameters on a Mask.

Amplitude at the start of simulation.

Phase, in rad, at the start of simulation.

Frequency, in Hz, at the start of simulation.

Bias at the start of simulation.

References

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2018b