# Derivative x(t) (G Dataflow)

Version:

Performs the discrete differentiation of the sampled signal.

## x(t)

Sampled signal from time 0 to n-1, where n is the number of elements in the sampled signal.

## method

Differentiation method.

Name Description
2nd Order Central The derivative of the sampled signal is defined by the following equation:
${y}_{i}=\frac{1}{2dt}\left({x}_{i+1}-{x}_{i-1}\right)$
for i =0, 1, 2, ..., n-1

where

• n is the number of samples
• x-1 is the first element in the initial condition
• xn is the first element in the final condition
4th Order Central The derivative of the sampled signal is defined by the following equation:
${y}_{i}=\frac{1}{12dt}\left(-{x}_{i+2}+8{x}_{i+1}-8{x}_{i-1}-{x}_{i-2}\right)$
for i =0, 1, 2, ..., n-1

where

• n is the number of samples
• x-2 and x-1 are the first and second elements in the initial condition
• xn and xn+1 are the first and second elements in the final condition
Forward The derivative of the sampled signal is defined by the following equation:
${y}_{i}=\frac{1}{dt}\left({x}_{i+1}-{x}_{i}\right)$
for i =0, 1, 2, ..., n-1

where

• n is the number of samples
• xn is the first element in the final condition
Backward The derivative of the sampled signal is defined by the following equation:
${y}_{i}=\frac{1}{dt}\left({x}_{i}-{x}_{i-1}\right)$
for i =0, 1, 2, ..., n-1

where

• n is the number of samples
• x-1 is the first element in the initial condition

Default: 2nd Order Central

## initial condition

Initial condition of the sampled signal in the differentiation calculation.

This node uses the first element of the initial condition if the differentiation method is 2nd Order Central or Forward. This node uses the first two elements in the initial condition if the differentiation method is 4th Order Central.

## final condition

Final condition of the sampled signal in the differentiation calculation.

This node uses the first element in the final condition if the differentiation method is 2nd Order Central or Forward. This node uses the first two elements if the differentiation method is 4th Order Central.

## error in

Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

Default: No error

## dt

Sampling interval.

Default: 1

## dx(t)/dt

Derivative of the sampled signal.

## error out

Error information. The node produces this output according to standard error behavior.

## Algorithm for Calculating the Derivative

The differentiation f(t) of a function F(t) is defined by the following equation.

$f\left(t\right)=\frac{d}{dt}F\left(t\right)$

Let Y represent the sampled output sequence dx(t)/dt.

If method is 2nd Order Central, Y is given by the following equation:

${y}_{i}=\frac{1}{2\text{dt}}\left({x}_{i+1}-{x}_{i-1}\right)$

for i = 0, 1, 2, ..., n - 1

where

• n is the number of samples in x(t)
• x-1 is the first element in initial condition
• xn is the first element in final condition

If method is 4th Order Central, Y is given by the following equation:

${y}_{i}=\frac{1}{12\text{dt}}\left(-{x}_{i+2}+8{x}_{i+1}-8{x}_{i-1}+{x}_{i-2}\right)$

for i = 0, 1, 2, ..., n - 1,

where

• n is the number of samples in x(t)
• x-2 and x-1 are the first and second elements in initial condition
• xn and xn + 1 are the first and second elements in final condition

If method is Forward, Y is given by the following equation:

${y}_{i}=\frac{1}{\text{dt}}\left({x}_{i+1}-{x}_{i}\right)$

for i = 0, 1, 2, ..., n - 1

where n is the number of samples in x(t) and xn is the first element in final condition.

If method is Backward, Y is given by the following equation:

${y}_{i}=\frac{1}{\text{dt}}\left({x}_{i}-{x}_{i-1}\right)$

for i = 0, 1, 2, ..., n - 1

where n is the number of samples in x(t) and x-1 is the first element in initial condition.

The initial condition and final condition minimize the error at the boundaries.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported