Math

Trigonometric Block

Trigonometric function selector: sin, cos, tan, asin, acos, atan, atan2

Open Trigonometric in BlockWerk →

# Trigonometric Block Documentation

Overview

The Trigonometric block provides 7 trigonometric functions in a single configurable block:

Inputs

Outputs

Parameters

Function

Type: Dropdown selector Default: sin Options:

| Function | Input range | Output range | Notes | | -------- | ------------------ | ------------ | -------------------------- | | sin | any (radians) | [-1, 1] | | | cos | any (radians) | [-1, 1] | | | tan | any (radians) | (-∞, +∞) | Discontinuous at ±π/2 + nπ | | asin | clamped to [-1, 1] | [-π/2, π/2] | Input auto-clamped | | acos | clamped to [-1, 1] | [0, π] | Input auto-clamped | | atan | any | (-π/2, π/2) | | | atan2 | y: any, x: any | (-π, π] | Full 360° angle recovery |

tan() Warning

The tangent function has singularities at x = ±π/2 + nπ (for any integer n). At these points, the output approaches ±∞. If your input signal passes through these values, the output will produce very large spikes. Consider:

atan2 Usage

atan2(y, x) computes the angle of the vector (x, y) in the range (-π, π]. Unlike atan(y/x), it correctly handles all four quadrants and the case where x = 0.

When atan2 is selected, a second input port "X (atan2)" appears. Connect:

If in2 is not connected, it defaults to 1.0 (equivalent to atan(y)).

Examples

Sine Wave Generation

Ramp (0 to 2π) → Trigonometric(sin) → uPlotDisplay

Full Angle Recovery with atan2

sin_signal → Trigonometric(atan2) ← cos_signal
                    ↓
             Angle (radians)

Remarks

See Also