Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

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

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

Pins

Input Pins

Name: in

Description: Input signal

...

Complex support: Real and Complex

Output Pins

Name: out

Description: Output signal

Data type: float

MATLAB Usage

File Name: sign_module.m

Code Block
 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.

...