Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rectpuls

Rectangular pulse


Description

Return samples of the unit-amplitude rectangular pulse at the times indicated by t.

Usage

rectpuls(t, w = 1)

Arguments

t

Sample times of unit rectangular pulse, specified by a vector.

w

Rectangle width, specified by a positive number. Default: 1

Details

y <- rectpuls(t) returns a continuous, aperiodic, unit-height rectangular pulse at the sample times indicated in array t, centered about t = 0.

y <- rectpuls(t, w) generates a rectangular pulse over the interval from -w/2 to w/2, sampled at times t. This is useful with the function pulstran for generating a series of pulses.

Value

Rectangular pulse of unit amplitude, returned as a vector.

Author(s)

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

See Also

Examples

fs <- 10e3
t <- seq(-0.1, 0.1, 1/fs)
w <- 20e-3
y <- rectpuls(t, w)
plot(t, y, type="l", xlab = "Time", ylab = "Amplitude")

fs <- 11025  # arbitrary sample rate
f0 <- 100    # pulse train sample rate
w <- 0.3/f0  # pulse width 1/10th the distance between pulses
y <- pulstran (seq(0, 4/f0, 1/fs), seq(0, 4/f0, 1/f0), 'rectpuls', w = w)
plot (seq(0, length(y)-1) * 1000/fs, y, type ="l", xlab = "Time (ms)",
      ylab = "Amplitude",
      main = "Rectangular pulse train of 3 ms pulses at 10 ms intervals")

gsignal

Signal Processing

v0.3-1
GPL-3
Authors
Geert van Boxtel [aut, cre] (Maintainer), Tom Short [aut] (Author of 'signal' package), Paul Kienzle [aut] (Majority of the original sources), Ben Abbott [ctb], Juan Aguado [ctb], Muthiah Annamalai [ctb], Leonardo Araujo [ctb], William Asquith [ctb], David Bateman [ctb], David Billinghurst [ctb], Juan Pablo Carbajal [ctb], André Carezia [ctb], Vincent Cautaerts [ctb], Eric Chassande-Mottin [ctb], Luca Citi [ctb], Dave Cogdell [ctb], Carlo de Falco [ctb], Carne Draug [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], R.G.H Eschauzier [ctb], Andrew Fitting [ctb], Alan J. Greenberger [ctb], Mike Gross [ctb], Daniel Gunyan [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Jake Janovetz [ctb], Alexander Klein [ctb], Peter V. Lanspeary [ctb], Bill Lash [ctb], Friedrich Leissh [ctb], Laurent S. Mazet [ctb], Mike Miller [ctb], Petr Mikulik [ctb], Paolo Neis [ctb], Georgios Ouzounis [ctb], Sylvain Pelissier [ctb], Francesco Potortì [ctb], Charles Praplan [ctb], Lukas F. Reichlin [ctb], Tony Richardson [ctb], Asbjorn Sabo [ctb], Thomas Sailer [ctb], Rolf Schirmacher [ctb], Rolf Schirmacher [ctb], Ivan Selesnick [ctb], Julius O. Smith III [ctb], Peter L. Soendergaard [ctb], Quentin Spencer [ctb], Doug Stewart [ctb], P. Sudeepam [ctb], Stefan van der Walt [ctb], Andreas Weber [ctb], P. Sudeepam [ctb], Andreas Weingessel [ctb]
Initial release
2021-05-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.