abs

Block Inputs: Real, complex, or fixed-point scalars, or vectors or matrices.

The abs block produces the absolute value of the input signal.

Label: Indicates a user-defined block label.

Examples

1. Absolute value of a scalar

Consider the equation y = abs (sin (t)), which can be realized as shown below.

The results in the two plot blocks show that the abs block computes the absolute value of the input signal.

2. Absolute value of a vector

Consider the equation:

 w = abs (x)

where x = [-7 1 -2.2]. This equation can be realized as:

When the simulation runs, the abs block computes and outputs an element-by-element absolute value of the vector x.

3. Absolute value of a matrix

Consider the equation:

  Z = abs(Q)

where

abs blk example 3

 This equation can be realized as shown below.

Four const blocks provide the vector element values of Q through a scalarToVector block. When the simulation runs, the abs block computes the element-by-element absolute value of the incoming matrix.