Generate a triangular pulse over the interval -w / 2 to w / 2, sampled at times t.
tripuls(t, w =1, skew =0)
Arguments
t: Sample times of triangle wave specified by a vector.
w: Width of the triangular pulse to be generated. Default: 1.
skew: Skew, a value between -1 and 1, indicating the relative placement of the peak within the width. -1 indicates that the peak should be at -w / 2, and 1 indicates that the peak should be at w / 2. Default: 0 (no skew).
Returns
Triangular pulse, returned as a vector.
Details
y <- tripuls(t) returns a continuous, aperiodic, symmetric, unity-height triangular pulse at the times indicated in array t, centered about t = 0 and with a default width of 1.
y <- tripuls(t, w) generates a triangular pulse of width w.
y <- tripuls(t, w, skew) generates a triangular pulse with skew skew, where −1≤skew≤1. When skew is 0, a symmetric triangular pulse is generated.
Examples
fs <-10e3t <- seq(-0.1,0.1,1/fs)w <-40e-3y <- tripuls(t, w)plot(t, y, type="l", xlab ="", ylab ="", main ="Symmetric triangular pulse")## displace into paste and futuretpast <--45e-3spast <--0.45ypast <- tripuls(t-tpast, w, spast)tfutr <-60e-3sfutr <-1yfutr <- tripuls(t-tfutr, w/2, sfutr)plot (t, y, type ="l", xlab ="", ylab ="", ylim = c(0,1))lines(t, ypast, col ="red")lines(t, yfutr, col ="blue")