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

NameDomainDirection
ysignalout

Parameters

NameUnitDefaultRangeDescription
k11Amplitude
Ts10 to ∞Period
offset10Lowest value
t0s0Start time

Variables

NameUnitStartDescription
period_startst0Time 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))