Reduce sampling rate of a time series

y = decdc(x,df)  % Matlab & Octave
y <- decdc(x, df)  # R

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.

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
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
  1. 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.
  2. 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).

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])
ans = 0.0023                    % i.e., there is almost no difference between s4 and ds. 


s <- matrix(sin(2 * pi / 100 * c(0:1000) - 1), ncol = 1)
plot(c(1:length(s)), s) # before decimation
y <- decdc(x = s, df = 4)
plot(c(1:length(y)), y) # after decimation Last modified: 10 May 2017

  • tagwiki/tools/processing/decdc.txt
  • Last modified: 2021/06/15 15:08
  • by sbf5