tripuls {gsignal}R Documentation

Sampled aperiodic triangle

Description

Generate a triangular pulse over the interval -w / 2 to w / 2, sampled at times t.

Usage

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).

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 \le skew \le 1. When skew is 0, a symmetric triangular pulse is generated.

Value

Triangular pulse, returned as a vector.

Author(s)

Paul Kienzle, Mike Miller.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

Examples


fs <- 10e3
t <- seq(-0.1, 0.1, 1/fs)
w <- 40e-3
y <- tripuls(t, w)
plot(t, y, type="l", xlab = "", ylab = "",
     main = "Symmetric triangular pulse")

## displace into paste and future
tpast <- -45e-3
spast <- -0.45
ypast <- tripuls(t-tpast, w, spast)
tfutr <- 60e-3
sfutr <- 1
yfutr <- 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")


[Package gsignal version 0.3-5 Index]