WOLFRAM SYSTEM MODELER

normalizeWithAssert

Return normalized vector such that length = 1 (trigger an assert for zero vector)

Wolfram Language

In[1]:=
SystemModel["Modelica.Math.Vectors.normalizeWithAssert"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

Vectors.normalizeWithAssert(v);

Description

The function call "Vectors.normalizeWithAssert(v)" returns the unit vector "v/sqrt(v*v)" of vector v. If vector v is a zero vector, an assert is triggered.

Since the function has the "Inline" annotation, it is usually inlined and symbolic processing is applied.

Example

normalizeWithAssert({1,2,3});  // = {0.267, 0.534, 0.802}
normalizeWithAssert({0,0,0});  // error (an assert is triggered)

See also

Vectors.length, Vectors.normalize

Syntax

result = normalizeWithAssert(v)

Inputs (1)

v

Type: Real[:]

Description: Real vector

Outputs (1)

result

Type: Real[size(v, 1)]

Description: Input vector v normalized to length=1