Triangle
signal.triangle
Rises in a straight line from offset to offset + k over the first half of each period T and falls back over the second half. Starts at time t0.
Ports
| Name | Domain | Direction |
|---|---|---|
y | signal | out |
Parameters
| Name | Unit | Default | Range | Description |
|---|---|---|---|---|
k | 1 | 1 | Amplitude | |
T | s | 1 | 0 to ∞ | Period |
offset | 1 | 0 | Lowest value | |
t0 | s | 0 | Start time |
Variables
| Name | Unit | Start | Description |
|---|---|---|---|
period_start | s | t0 | Time the current period began |
Equations
der(period_start) = 0 when time >= period_start + T then reinit(period_start, period_start + T) y = offset + (if time < t0 then 0 else if time - period_start < T / 2 then 2 * k * (time - period_start) / T else 2 * k * (1 - (time - period_start) / T))