/
(8.D.2.3) Derivative

(8.D.2.3) Derivative

Overview

Discrete-time derivative

Discussion

Computes the derivative of a discrete-time signal. The derivative is defined as:

$y[n] = K/T * (x[n] - x[n-1])$ where T is the sample period and K is the optional gain parameter. The module sets the default starting value to x[-1] = 0.

The discrete derivative is similar to the continuous time derivative. For example, if the input is a sine wave at 1 kHz, then the output will be a cosine at 1 kHz scaled by 2*pi*1000.

The hidden internal array .lastValue stores the previous value x[n-1] between blocks. The length of the array is set by the prebuild function to the number of channels.

Type Definition

typedef struct _ModuleDerivative { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 gain; // Additional gain. FLOAT32* lastValue; // Previous value x[n-1]. } ModuleDerivativeClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

gain

float

parameter

0

1

-10:10

linear

lastValue

float*

state

1

[1 x 1]

Unrestricted

 

Pins

Input Pins

Name: in

Description: Input signal

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Output signal

Data type: float

MATLAB Usage

File Name: derivative_module.m

M=derivative_module(NAME) This module computes the derivative of the input signal. Mathematically, this is: y[n] = 1/dt * (x[n] - x[n-1]) where dt is the time step, dt = 1/SR. The module has a multichannel input and computes the derivative per channel. Arguments: NAME - name of the module.

 

Related content

(8.D.2.4) Derivative
(8.D.2.4) Derivative
More like this
(8.D.2.7) Derivative
(8.D.2.7) Derivative
More like this
(8.D.2.5) Derivative
(8.D.2.5) Derivative
More like this
(8.D.2.6) Derivative
(8.D.2.6) Derivative
More like this
(8.D.2.2) Derivative
(8.D.2.2) Derivative
More like this
(8.D.2.2 ) Derivative
(8.D.2.2 ) Derivative
More like this