Equidistant point interval.

Namespace: dsp

Prototype

static Vecf linspace(float a, float b, unsigned int n)

Parameters

aInitial point (first value)
bFinal point (last value)
nNumber of points

Returns

Interval defined as: \[ x_k = a + k \cdot \frac{b-a}{n-1},\ k = 0,\dots,n-1 \]

Description

Compute \(n\) equidistant points between \(a\) and \(b\).

Example 1: vector with the #5 first integers:

let t = linspace(0, n-1, n)
// t = 0, 1, 2, ..., n-1


Example 2: vector of #5 time points, with a sampling frequency of #107 Hz:

let t = linspace(0, (n-1)/fs, n)

See also

logspace()