Document toolboxDocument toolbox

(8.D.2.4) Sign

Overview

Computes the sign (-1, 0, or +1) of a floating-point value

Discussion

Computes the sign function of a floating-point number. The value returned is: -1.0 for x < 0, 0 for x = 0, and +1.0 for x > 0

For complex inputs, the function computes a complex output which equals X ./ abs(X). This is a unit vector that points in the same direction as X

Type Definition

typedef struct _ModuleSign { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure } ModuleSignClass;

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 and Complex

Output Pins

Name: out

Description: Output signal

Data type: float

MATLAB Usage

File Name: sign_module.m

M=sign_module(NAME) Creates an Audio Weaver module that computes the function sign(x) of a floating-point value. The value is: sign(x) = 1.0 if x > 0 sign(x) = 0.0 if x == 0 sign(x) = -1.0 if x < 0 Arguments: NAME - name of the module.

Â