upsample

Oversampling of a column vector.

Namespace: dsp

Prototype

Vector<T> upsample(const Vector<T> &x, int R)

Description

From a vector \((x_k), k=0\dots n-1\), returns a upsampled vector of size \(Rn\), by inserting zeroes: \[ y_k = \begin{cases} x_{k/R} & \textrm{if } k\textrm{ is a multiple of } R,\\ 0 & \textrm{otherwise.}\end{cases} \]

Example

  soit x = linspace(1, 10, 10);
  soit y = surech(x, 10);

  Figures f;
  f.subplot().plot(x, "b|o", "x");
  f.subplot().plot(y, "g|o", "y");

See also

downsample()