resample

Finite signal resampling, with arbitrary ratio.

Namespace: dsp

Prototype

auto resample(const Vector<T> &x, float r)

Parameters

xInput signal
rResampling factor ( \(f_e^{(2)} / f_e^{(1)}\))

Returns

Resampled signal

Description

This function resample a signal with a decimation ( \(r < 1\)) or interpolation ( \(r > 1\)) ratio.

Note
A filter (or even a cascad of filters) is automatically inserted (before decimation or after interpolation) so as to avoir spectrum aliasing.


Example


  // Sinusoïde échantillonnée à 1/5ième de la fréquence d'échantillonnage
  soit x = sigsin(0.2, 40);

  // Multiplie la fréquence d'échantillonnage par 50
  // (y aura donc 50 fois plus d'échantillons).
  soit y = rééchan(x, 50);

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

Note
Because of the anti-aliasing filters, the output signal will be delayed compared to the input one. To resample without intruducing delay, one can use resample_freq().

See also

dsp::filter::filter_resampling() (to process infinite lien non trouvé : [namespacedsp_1_1time]time signal), resample_freq() (zero-delay resampling).