# Filtered Derivative (Discrete or Continuous)

Discrete-time or continuous-time filtered derivative

**Libraries:**

Simscape /
Electrical /
Control /
General Control

## Description

The Filtered Derivative (Discrete or Continuous) block implements a
filtered derivative in conformance with IEEE 421.5-2016^{[1]}.

You can switch between continuous and discrete implementations of the derivative using
the **Sample time** parameter.

### Equations

**Continuous**

To configure the filtered derivative for continuous time, set the
**Sample time** property to `0`

. This
representation is equivalent to the continuous transfer function:

$$G(s)=\frac{Ks}{Ts+1},$$

where:

*K*is the gain.*T*is the time constant.

From the preceding transfer function, the derivative defining equations are:

$$\{\begin{array}{c}\dot{x}(t)=\frac{1}{T}\left(Ku(t)-x(t)\right)\\ y(t)=\frac{1}{T}\left(Ku(t)-x(t)\right)\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}x(0)={u}_{0},\text{\hspace{0.17em}}y(0)=0,$$

where:

*u*is the block input.*x*is the state.*y*is the block output.*t*is the simulation time.*u*is the initial input to the block._{0}

**Discrete**

To configure the filtered derivative for discrete time, set the
**Sample time** property to a positive, nonzero value, or
to `-1`

to inherit the sample time from an upstream block. The
discrete representation is equivalent to the transfer function:

$$\left(\frac{K}{T}\right)\frac{z-1}{z+{T}_{s}/T-1},$$

where:

*K*is the gain.*T*is the time constant.*T*is the sample time._{s}

From the discrete transfer function, the derivative equations are defined using the forward Euler method:

$$\{\begin{array}{c}x(n+1)=\left(1-\frac{{T}_{s}}{T}\right)x(n)+\left(\frac{{T}_{s}}{T}\right)u(n)\\ y(n)=\frac{K}{T}\left(u(n)-x(n)\right)\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}x(0)={u}_{0},\text{\hspace{0.17em}}y(0)=0,$$

where:

*u*is the block input.*x*is the block state.*y*is the block output.*n*is the simulation time step.*u*is the initial input to the block._{0}

### Initial Conditions

To specify the initial conditions of this block, set
**Initialization** to:

`Inherited from block input`

— The block sets the state initial condition to the initial input, making the initial output zero.`Specify as parameter`

— The block sets the state initial condition to the value of**Initial state**.

### Limiting the Output

Limit the filtered derivative output by setting the **Upper saturation
limit** and **Lower saturation limit** parameters to
finite values.

Unlike other common blocks given in IEEE 421.5-2016, there is no difference between the windup and anti-windup saturation methods for the filtered derivative. The output can respond immediately to a reversal of the input sign when the output is saturated.

## Ports

### Input

### Output

## Parameters

## References

[1] IEEE. 2016. *IEEE
Recommended Practice for Excitation System Models for Power System Stability
Studies.* IEEE Std 421.5-2016. Piscataway, NJ: IEEE-SA,
2016.

## Extended Capabilities

## Version History

**Introduced in R2017b**