fracshift function

Fractional shift

Fractional shift

Shift a signal by a (possibly fractional) number of samples.

fracshift(x, d, h = NULL)

Arguments

  • x: input data, specified as a numeric vector.
  • d: number of samples to shift x by, specified as a numeric value
  • h: interpolator impulse response, specified as a numeric vector. If NULL (default), the interpolator is designed by a Kaiser-windowed sinecard.

Returns

A list of matrices size nr, where nr is the number of rows in x. Each element of the list contains a matrix with two rows. The first row is the initial index of a sequence of 1s and the second row is the end index of that sequence. If nr == 1 the output is a matrix with two rows.

Details

The function calculates the initial index and end index of the sequences of 1’s in the rows of x. The clusters are sought in the rows of the array x. The function works by finding the indexes of jumps between consecutive values in the rows of x.

Examples

N = 1024 t <- seq(0, 1, length.out = N) x <- exp(-t^2 / 2 / 0.25^2) * sin(2 * pi * 10 * t) dt <- 0.25 d <- dt / (t[2] - t[1]) y <- fracshift(x, d) plot(t, x, type = "l", xlab = "Time", ylab = "Sigfnal") lines (t, y, col = "red") legend("topright", legend = c("original", "shifted"), lty = 1, col = 1:2)

References

[1] A. V. Oppenheim, R. W. Schafer and J. R. Buck, Discrete-time signal processing, Signal processing series, Prentice-Hall, 1999.

[2] T.I. Laakso, V. Valimaki, M. Karjalainen and U.K. Laine Splitting the unit delay, IEEE Signal Processing Magazine, vol. 13, no. 1, pp 30--59 Jan 1996.

Author(s)

Eric Chassande-Mottin, ecm@apc.univ-paris7.fr ,

Juan Pablo Carbajal, carbajal@ifi.uzh.ch ,

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

  • Maintainer: Geert van Boxtel
  • License: GPL-3
  • Last published: 2024-09-11