decdc
Reduce sampling rate of a time series
Syntax
y = decdc(x,df) % Matlab & Octave y <- decdc(x, df) # R
Description
Reduce the sampling rate of a time series by an integer factor. This is similar to decimate() and resample() but is delay free and DC accurate which are important for sensor data.
Inputs
Input var | Description | Units | Default value |
---|---|---|---|
x | x is a vector or matrix containing the signal(s) to be decimated. If x is a matrix, each column is decimated separately. | N/A | N/A |
df | If x is a matrix, each column is decimated separately.The output sampling rate is the input sampling rate divided by df. df must be an integer greater than 1. | N/A | N/A |
Outputs
Output var | Description | Units |
---|---|---|
y | y is the decimated signal vector or matrix. It has the same number of columns as x but has 1/df of the rows. | N/A |
Notes & assumptions
- Decimation is performed by first low-pass filtering x and then keeping 1 sample out of every df. A symmetric FIR filter with length 12*df and cutoff frequency 0.4*fs/df is used. The group delay of the filter is removed.
- For large decimation factors (e.g., df»20), it is better to perform several decimations with lower factors. For example to decimate by 120, use: decdc(decdc(x,10),12).
Example
Matlab & Octave
s=sin(2*pi/100*(0:1000-1)'); % sine wave at full sampling rate s4=sin(2*pi*4/100*(0:250-1)'); % same sine wave at 1/4 of the sampling rate ds=decdc(s,4); % decimate the full rate sine wave plot([s4 ds]) max(abs(s4-ds)) ans = 0.0023 % i.e., there is almost no difference between s4 and ds.
R
s <- matrix(sin(2 * pi / 100 * c(0:1000) - 1), ncol = 1) y <- decdc(x = s, df = 4) y = 0.0023
References & Suggested Reading
About
bugs@animaltags.org Last modified: 10 May 2017