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:
- sin(x) - Sine
- cos(x) - Cosine
- tan(x) - Tangent
- asin(x) - Arcsine (inverse sine)
- acos(x) - Arccosine (inverse cosine)
- atan(x) - Arctangent (inverse tangent)
- atan2(y,x) - Two-argument arctangent
Inputs
- Input (in): Primary numeric signal (angle in radians for sin/cos/tan, value for inverse functions, y for atan2)
- X (atan2) (in2): Secondary input, only used when function is
atan2. Represents the x-coordinate.
Outputs
- Output: Result of the selected trigonometric function
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:
- Clamping the input to avoid the singularities
- Using atan/atan2 instead if you need angle computation
- Adding a Saturation block after the Trigonometric block
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:
- in (primary): the y-coordinate
- in2 (secondary): the x-coordinate
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
- Angle units: All trigonometric functions use radians; convert degrees to radians via Gain(× π/180)
- tan singularities: tan(x) approaches ±∞ at x = π/2 + nπ; place a Saturation block after tan if your signal crosses these points
- atan2: The two-argument arctangent recovers the full angle (−π, π] from (y, x) coordinates; connect y to
inand x toin2 - asin/acos clamping: Input values outside [−1, 1] are automatically clamped; consider a Saturation block beforehand for explicit bounds
- Periodic outputs: sin/cos outputs are bounded to [−1, 1]; scale with Gain to match your signal range
See Also
Gain,Saturation- Signal conditioningSignalGenerator- Alternative sinusoidal sourceMathFunction- Other mathematical operations