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

interp

Interpolate / Increase the sample rate


Description

Upsample a signal by a constant factor by using an FIR filter to interpolate between points.

Usage

interp(x, q, n = 4, Wc = 0.5)

Arguments

x

the signal to be upsampled.

q

the integer factor to increase the sampling rate by.

n

the FIR filter length.

Wc

the FIR filter cutoff frequency.

Details

It uses an order 2*q*n+1 FIR filter to interpolate between samples.

Value

The upsampled signal, an array of length q * length(x).

Author(s)

Original Octave version by Paul Kienzle pkienzle@user.sf.net. Conversion to R by Tom Short.

References

Octave Forge http://octave.sf.net

See Also

Examples

# The graph shows interpolated signal following through the
# sample points of the original signal.
t <- seq(0, 2, by = 0.01)
x <- chirp(t, 2, 0.5, 10, 'quadratic') + sin(2*pi*t*0.4)
y <- interp(x[seq(1, length(x), by = 4)], 4, 4, 1) # interpolate a sub-sample
plot(t, x, type = "l")
idx <- seq(1,length(t),by = 4)
lines(t, y[1:length(t)], col = "blue")
points(t[idx], y[idx], col = "blue", pch = 19)

signal

Signal Processing

v0.7-6
GPL-2
Authors
Uwe Ligges [aut, cre] (new maintainer), Tom Short [aut] (port to R), Paul Kienzle [aut] (majority of the original sources), Sarah Schnackenberg [ctb] (various test cases and bug fixes), David Billinghurst [ctb], Hans-Werner Borchers [ctb], Andre Carezia [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], E. Farhi [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Sebastian Krey [ctb], Bill Lash [ctb], Friedrich Leisch [ctb], Olaf Mersmann [ctb], Paulo Neis [ctb], Jaakko Ruohio [ctb], Julius O. Smith III [ctb], Doug Stewart [ctb], Andreas Weingessel [ctb]
Initial release
2015-07-29

We don't support your browser anymore

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