Integral

Overview

Discrete-time running-sum integral

Discussion

Approximates the integral of a discrete-time signal using the rectangle method. The integral is defined as:

$y[n] = T/K * \sum_{k=0}^n x[k]$ where T is the sample period and K is an optional gain parameter.

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

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

Type Definition

CODE
typedef struct _ModuleIntegral
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
FLOAT32* cumSum;                              // Running sum of input samples since last reset.
} ModuleIntegralClass;

Variables

Properties

 Name Type Usage isHidden Default value Range Units gain float parameter 0 1 -10:10 linear cumSum 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: integral_module.m

CODE
 This module computes the running-sum approximation of the integral of
the input signal.  Mathematically, this is:
y[n] = dt/K * sum(x[0] .. x[n])
where dt is the time step, dt = 1/SR and K is a gain.  The module has a
multichannel input and computes the integral per channel.  Arguments:
NAME - name of the module.

JavaScript errors detected