pad_zeros

Add zeros at the end of one of two vectors such as they have the same length.

Namespace: dsp

Prototype

tuple<Vector<T1>, Vector<T2>> pad_zeros(const Vector<T1> &x, const Vector<T2> &y, bool p2=false)

Parameters

xFirst vector
ySecond vector
p2If true, make sure the two new vectors length is a power of two.

Returns

A tuple of two vectors with the same length, and beginnning respectively by x and y (zeros are added at the end).

Description

One of the two vectors is padded with zeros such as the two vectors have the same length.

Example

let x = linspace(0,4,5),
// x = {0, 1, 2, 3, 4};
    y = linspace(0,3,4);
// y = {0, 1, 2, 3};

let [x2,y2] = pad_zeros(x,y);
// x2 = {0, 1, 2, 3, 4};
// y2 = {0, 1, 3, 4, 0};