decimate | R Documentation |
Decimate with 'FIR' or 'IIR' filter
decimate(x, q, n = if (ftype == "iir") 8 else 30, ftype = "fir")
x |
signal to be decimated |
q |
integer factor to down-sample by |
n |
filter order used in the down-sampling; default is |
ftype |
filter type, choices are |
This function is migrated from gsignal
package,
but with padding and indexing fixed. The results agree with 'Matlab'.
Decimated signal
x <- 1:100
y <- decimate(x, 2, ftype = "fir")
y
# compare with signal package
z <- gsignal::decimate(x, 2, ftype = "fir")
# Compare decimated results
plot(x, type = 'l')
points(seq(1,100, 2), y, col = "green")
points(seq(1,100, 2), z, col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.