Sign Sign Icon

Mathematical.Sign

Sign

A component that outputs the sign of a real-valued input signal.

Description

The Sign block computes the sign of input u using the built-in sign() function. The output y indicates whether the input is positive, negative, or zero.

Variables

  • u(t): Input signal
  • y(t): Output signal (sign of u)
    • y = 1, if u > 0
    • y = 0, if u = 0
    • y = -1, if u < 0

Examples

  • u = 5 → y = 1
  • u = 0 → y = 0
  • u = -3.2 → y = -1

This component extends from BlockComponents.SISO

Usage

PrimitiveComponents.Mathematical.Sign()

Connectors

  • u - This connector represents a real signal as an input to a component (RealInput)
  • y - This connector represents a real signal as an output from a component (RealOutput)

Behavior

\[ \begin{align} y\left( t \right) &= sign\left( u\left( t \right) \right) \end{align} \]

Source

"""
    Sign

A component that outputs the sign of a real-valued input signal.

# Description
The Sign block computes the sign of input `u` using the built-in `sign()` function.
The output `y` indicates whether the input is positive, negative, or zero.

# Variables
- `u(t)`: Input signal
- `y(t)`: Output signal (sign of u)
  - y =  1, if u > 0
  - y =  0, if u = 0
  - y = -1, if u < 0

# Examples
- u =  5   → y =  1
- u =  0   → y =  0
- u = -3.2 → y = -1
"""
component Sign
  extends BlockComponents.SISO
relations
  y = sign(u)
metadata {
  "Dyad": {
    "experiments": {},
    "tests": {},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 1100,
        "rot": 0,
        "layer": "icon",
        "attrs": {}
      }
    ],
    "icons": {"default": "dyad://PrimitiveComponents/Sign.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end
Flattened Source
"""
    Sign

A component that outputs the sign of a real-valued input signal.

# Description
The Sign block computes the sign of input `u` using the built-in `sign()` function.
The output `y` indicates whether the input is positive, negative, or zero.

# Variables
- `u(t)`: Input signal
- `y(t)`: Output signal (sign of u)
  - y =  1, if u > 0
  - y =  0, if u = 0
  - y = -1, if u < 0

# Examples
- u =  5   → y =  1
- u =  0   → y =  0
- u = -3.2 → y = -1
"""
component Sign
  "Input signal port"
  u = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0},
        "diagram": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      }
    }
  }
  "Output signal port"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
relations
  y = sign(u)
metadata {
  "Dyad": {
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 1100,
        "rot": 0,
        "layer": "icon",
        "attrs": {}
      }
    ],
    "experiments": {},
    "tests": {},
    "icons": {"default": "dyad://PrimitiveComponents/Sign.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses