# Second-Order Filter (Variable-Tuned)

Implement second-order variable-tuned filter

## Library

Simscape / Electrical / Specialized Power Systems / Control / Filters

• ## Description

Depending on the Filter type selected in the block menu, the Second-Order Filter block implements the following transfer function. The Fn input determines the filter natural frequency ${f}_{n}={\omega }_{n}/\left(2\pi \right)$ of the filter.

Lowpass filter:

`$H\left(s\right)=\frac{{\omega }_{n}^{2}}{{s}^{2}+2\zeta {\omega }_{n}s+{\omega }_{n}^{2}}$`

Highpass filter:

`$H\left(s\right)=\frac{{s}^{2}}{{s}^{2}+2\zeta {\omega }_{n}s+{\omega }_{n}^{2}}$`

Bandpass filter:

`$H\left(s\right)=\frac{2\zeta {\omega }_{n}s}{{s}^{2}+2\zeta {\omega }_{n}s+{\omega }_{n}^{2}}$`

Bandstop (Notch) filter:

`$H\left(s\right)=\frac{{s}^{2}+{\omega }_{n}^{2}}{{s}^{2}+2\zeta {\omega }_{n}s+{\omega }_{n}^{2}}$`

## Parameters

Filter type

Specify the type of filter: `Lowpass`, `Highpass`, `Bandpass`, or `Bandstop (Notch)` (default).

Initial natural frequency fn (Hz)

The initial natural frequency of the filter, in hertz. This value must be a scalar or a vector. Default is `120`.

Damping ratio Zeta (Q = 1/(2*Zeta))

Specify the damping ratio of the filter. The damping ratio is typically a value between 0 and 1. Default is `0.707`.

The damping ratio is related to the filter quality factor Q:

`$Q=\frac{1}{2\zeta }$`

For a bandpass or a bandstop filter, the 3 dB bandwidth is given by

`$BW=\frac{{f}_{n}}{Q}=2\zeta {f}_{n}$`

Sample time

Specify the sample time of the block, in seconds. Set to 0 to implement a continuous block. Default is `0`.

Initialize filter states

When this check box is selected, filter states are initialized according to the AC initial input and DC initial input parameters. Default is selected.

AC initial input: [ Mag, Phase (degrees), Freq (Hz) ]

Specify the magnitude of the initial AC component of the input signal, its phase, in degrees, and its frequency, in hertz. Default is `[0, 0, 60]`.

When the input is vectorized (N signals), specify an N-by-3 matrix, where each row of the matrix corresponds to a particular input.

The AC initial input parameter is visible only when the Initialize filter states parameter is selected.

DC initial input

Specify the value of the initial DC component of the input signal. When the input signal is vectorized, specify a 1-by-N vector, where each value corresponds to a particular input. Default is `0`.

The DC initial input parameter is visible only when the Initialize filter states parameter is selected.

## Inputs and Outputs

The inputs accept vectorized signals of N values, thus implementing N filters. This capability is particularly useful for designing controllers in three-phase systems (N = 3).

## Characteristics

 Direct Feedthrough Yes Sample Time Specified in the Sample Time parameter Continuous if Sample Time = 0 Scalar Expansion Yes, of the parameters States Two states per filter Dimensionalized Yes

## Examples

The `power_SecondOrderFilterTuned` example shows various uses of the Second-Order Filter (Variable-Tuned) block with two Filter type parameter settings (`Lowpass` and `Bandstop`).

The model sample time is parameterized with variable Ts (default value Ts = 50e-6). To simulate continuous filters, specify Ts = 0 in the MATLAB® Command Window before starting the simulation.

## Version History

Introduced in R2013a