.Modelica.Math.Vectors.normalizeWithAssert

Information

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

Interface

function normalizeWithAssert
  import Modelica.Math.Vectors.length;
  extends Modelica.Icons.Function;
  input Real v[:] "Real vector";
  output Real result[size(v, 1)] "Input vector v normalized to length=1";
end normalizeWithAssert;

Generated at 2024-11-21T19:25:40Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos