Sample and hold oversampling.

Namespace: dsp::telecom

Prototype

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

Parameters

xInput vector.
RNumber of samples to hold (e.g. oversampling factor).

Returns

Oversampled signal.

Description

Each sample of the input signal is repeated \(R\) times. For instance, if \(R = 2\), and \(x = x_0, x_1, \dots\), then \(y = x_0, x_0, x_1, x_1, \dots\)

This function can be used to generate NRZ sequence.

Example 1: duplicating values

Vecf x(5);
x << 0, 1, 2, 3, 4;
Vecf y = sah(x, 2);
// y = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]


Example 2: generating a pseudo-random NRZ sequence

int nsymbs = 5;  // Number of symbol to generate
int osf    = 10; // Over-sampling ratio
Vecf y = sah(randb(nsymbs), osf);
// Will generate nsymbs * osf samples (each symbol is repeated osf times)