The function ab2phth
transforms an input matrix
a
of size \(T \times p\) containing the sine and cosine
coefficients in the real Fourier series representation,
to the \(T \times p\) output matrix phi
according to
\( \phi_{n,j} = a_{1,j} + \sum_{k=1}^{\left\lfloor T/2 \right\rfloor }(a_{2k,j} \cos(2\pi kn/T) + a_{2k+1,j} \sin(2\pi kn/T))\)
for \( n = 1, \ldots, T \) and \( j = 1, \ldots, p\).
The inverse transformation is implemented in phth2ab
function.