Main Content

Normalization

Perform vector normalization along rows, columns, or specified dimension

  • Normalization block

Libraries:
DSP System Toolbox / Math Functions / Math Operations

Description

The Normalization block independently normalizes each row, column, or vector of the specified dimension of the input using the Squared 2-norm or the 2-norm methods.

For more information on how the block normalizes the signal, see Algorithms.

Examples

Ports

Input

expand all

Specify the input signal as a scalar, vector, matrix, or an N-D array. You can specify both fixed- and floating-point signals in the Squared 2-norm mode but only floating-point signals in the 2-norm mode.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
Complex Number Support: Yes

Output

expand all

Normalized output, returned as a scalar, vector, matrix, or an N-D array. The output always has the same size, data type, and complexity as the input signal.

For more information on how the block normalizes the signal, see Algorithms.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
Complex Number Support: Yes

Parameters

expand all

Main Tab

Specify the type of normalization to perform as one of these:

  • Squared 2-norm –– Supports both floating-point and fixed-point signals.

  • 2-norm –– Supports only floating-point signals.

Specify the normalization bias as a nonnegative scalar. This is the real value b which the block adds in the denominator to avoid division by zero.

Tunable: Yes

Specify the dimension over which to normalize as one of these:

  • Each column

  • Each row

  • Specified dimension –– Use the Dimension parameter to specify the dimension.

Specify the one-based value of the dimension over which to normalize as a positive integer. The value of this parameter cannot exceed the number of dimensions in the input signal.

Dependencies

To enable this parameter, set the Normalize over parameter to Specified dimension.

Data Types Tab

Note

The parameters on this tab are applicable only to fixed-point signals when the block is in squared 2-norm mode. See Fixed-Point Data Types for a diagram of how the product output, accumulator, and output data types are used in this case.

Specify the rounding mode for fixed-point operations as one of the following:

  • Floor

  • Ceiling

  • Convergent

  • Nearest

  • Round

  • Simplest

  • Zero

For more details, see Rounding Modes.

When you select this parameter, the block saturates the result of its fixed-point operation. When you clear this parameter, the block wraps the result of its fixed-point operation. For details on saturate and wrap, see overflow mode for fixed-point operations.

Specify the product output data type. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Same as input

  • An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Product output parameter.

See Specify Data Types Using Data Type Assistant (Simulink) for more information.

Specify the accumulator data type. See Fixed-Point Data Types for illustrations depicting the use of the accumulator data type in this block. You can set this parameter to:

  • A rule that inherits a data type, for example, Inherit: Same as product output

  • A rule that inherits a data type, for example, Inherit: Same as input

  • An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Accumulator parameter.

See Specify Data Types Using Data Type Assistant (Simulink) for more information.

Specify the output data type. See Fixed-Point Data Types for illustrations depicting the use of the output data type in this block. You can set this parameter to:

  • A rule that inherits a data type, for example, Inherit: Same as product output

  • A rule that inherits a data type, for example, Inherit: Same as input

  • A rule that inherits a data type, for example, Inherit: Same as accumulator

  • An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output parameter.

See Control Data Types of Signals (Simulink) for more information.

Specify the minimum value that the block should output. The default value is [] (unspecified). Simulink® software uses this value to perform:

  • Simulation range checking (see Specify Signal Ranges (Simulink))

  • Automatic scaling of fixed-point data types

Specify the maximum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:

  • Simulation range checking (see Specify Signal Ranges (Simulink))

  • Automatic scaling of fixed-point data types

Select this parameter to prevent the fixed-point tools from overriding the data types you specify in the block dialog box.

Block Characteristics

Data Types

double | fixed point | integer | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

yes

Zero-Crossing Detection

no

More About

expand all

Algorithms

This block treats an arbitrarily dimensioned input U as a collection of vectors oriented along the specified dimension. The block normalizes these vectors by either their norm or the square of their norm.

For example, consider a 3-D input U(i,j,k) and assume that you want to normalize along the second dimension. First, define the 2-D intermediate quantity V(i,k) such that each element of V is the norm of one of the vectors in U

V(i,k)=(j=1JU2(i,j,k))1/2.

Given V, the output of the block Y(i,j,k) in 2-norm mode is given by

Y(i,j,k)=U(i,j,k)V(i,k)+b.

In squared 2-norm mode, the block output is given by

Y(i,j,k)=U(i,j,k)V(i,k)2+b.

The normalization bias b is typically chosen to be a small positive constant (for example, 1e-10) that prevents potential division by zero.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced before R2006a