Learn R Programming

tagtools (version 0.2.0)

decdc: Reduce the sampling rate

Description

This function is used to reduce the sampling rate of a time series by an integer factor.

Usage

decdc(x, df)

Value

y The decimated signal vector or matrix. It has the same number of columns as x but has 1/df of the rows.

Arguments

x

A data structure, vector or matrix containing the signal(s) to be decimated. If x is a matrix, each column is decimated separately.

df

The decimation factor. The output sampling rate is the input sampling rate divided by df. df must be an integer greater than 1.

Examples

Run this code
s <- matrix(sin(2 * pi / 100 * c(0:1000) - 1), ncol = 1)
plot(c(1:length(s)), s) 
y <- decdc(x = s, df = 4)
plot(c(1:length(y)), y) 

Run the code above in your browser using DataLab