downsample

Decimation of a column vector.

Namespace: dsp

Prototype

Vector<T> downsample(const Vector<T> &x, int pas)

Description

From a vector \((x_k), k=0\dots n-1\), returns a subset of it, decimated by a factor of \(R\): \[ y_k = x_{kR},\quad k =0 \dots \left\lfloor N/R\right\rfloor -1 \]

Example

  soit x = linspace(1, 20, 20);
  soit y = sousech(x, 2);

  Figure f;
  f.plot(x, x, "b-", "x");
  f.plot(y, y, "or", "y");

See also

upsample()