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

sigmoid_train

Sigmoid Train


Description

Evaluate a train of sigmoid functions at t.

Usage

sigmoid_train(t, ranges, rc)

Arguments

t

Vector (or coerced to a vector) of time values at which the sigmoids are calculated.

ranges

Matrix or array with 2 columns containing the time values within t at which each sigmoid is evaluated. The number of sigmoids is determined by the number of rows in ranges.

rc

Time constant. Either a scalar or a matrix or array with 2 columns containing the rising and falling time constants of each sigmoid. If a matrix or array is passed in rc, its size must equal the size of ranges. If a single scalar is passed in rc, then all sigmoids have the same time constant and are symmetrical.

Details

The number and duration of each sigmoid is determined from ranges. Each row of ranges represents a real interval, e.g. if sigmoid i starts at t = 0.1 and ends at t = 0.5, then ranges[i, ] = c(0.1, 0.5). The input rc is an array that defines the rising and falling time constants of each sigmoid. Its size must equal the size of ranges.

The individual sigmoids are returned in s. The combined sigmoid train is returned in the vector y of length equal to t, and such that y = max(s).

Value

A list consisting two variables; y the combined sigmoid train (length identical to t), and s, the individual sigmoids (number of rows equal to number of rows in ranges and rc.

Author(s)

Juan Pablo Carbajal, carbajal@ifi.uzh.ch.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

Examples

t <- seq(0, 2, length.out = 500)
ranges <- rbind(c(0.1, 0.4), c(0.6, 0.8), c(1, 2))
rc <- rbind(c(1e-2, 1e-3), c(1e-3, 2e-2), c(2e-2, 1e-2))
st <- sigmoid_train (t, ranges, rc)
plot(t, st$y[1,], type="n", xlab = "Time(s)", ylab = "S(t)",
     main = "Vectorized use of sigmoid train")
for (i in 1:3) rect(ranges[i, 1], 0, ranges[i, 2], 1,
                    border = NA, col="pink")
for (i in 1:3) lines(t, st$y[i,])
# The colored regions show the limits defined in range.

t <- seq(0, 2, length.out = 500)
ranges <- rbind(c(0.1, 0.4), c(0.6, 0.8), c(1, 2))
rc <- rbind(c(1e-2, 1e-3), c(1e-3, 2e-2), c(2e-2, 1e-2))
amp <- c(4, 2, 3)
st <- sigmoid_train (t, ranges, rc)
y <- amp %*% st$y
plot(t, y[1,], type="l", xlab = 'time', ylab = 'signal',
     main = 'Varying amplitude sigmoid train', col="blue")
lines(t, st$s, col = "orange")
legend("topright", legend = c("Sigmoid train", "Components"),
       lty = 1, col = c("blue", "orange"))

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.