Sign

Sign of the input: −1, 0, or 1.

  • signal
  • Gradara equations
  • 2 ports
BlockSignKindsignLibraryMath

Description

Outputs the sign of its input: 1 for positive, −1 for negative, 0 at exactly zero.

Example

Math functions Gain, absolute value, square root, sign, negation, and power of a sine; sine and cosine of time.

u = 2 sin(πt/2)Gain 0.5|u|√|u|sign(u)−uu²Timesin(t)cos(t)
In Gradara, select a Sign block and press F1, then choose Open example. It opens as a new model in My models, ready to run.

Also in this example:GainSine waveClockAbsSqrtSinCosUnary minusPower

Ports

Inputs 1

  • u

    Input signal.

Outputs 1

  • y

    Output signal: −1, 0, or 1.

Equations

Modelica
y = 1 if u > 0
y = −1 if u < 0
y = 0 if u = 0

Implementation

The block’s Modelica model
y = if u > 0 then 1 else (if u < 0 then -1 else 0);

Assumptions and limitations

  • The output jumps where u crosses zero, which causes a solver event at each crossing.

See also

Select a block in Gradara and press F1 to open its page offline.