Inner Products and Cosines Between Components
measureOrthogonality.RdComputes the inner products between the columns of a matrix of components and the cosines of the angles between them.
Details
The inner products are the Euclidean products \(\sum_n v_i[n] v_j[n]\), without the sampling interval of the discrete inner product, which cancels in the cosine $$\cos\theta_{ij} = \frac{\langle v_i, v_j \rangle}{\|v_i\|_2 \|v_j\|_2}.$$ The cosine keeps its sign. The cross products are the terms by which the energy of a sum of components differs from the sum of their energies.
Value
A list of two square matrices, components by components:
- innerProduct
The inner products.
- cosine
The cosines.
Examples
Time <- seq_len(1000) / 1000
Tones <- cbind(cos(2 * pi * 2 * Time), 0.25 * cos(2 * pi * 24 * Time),
0.0625 * cos(2 * pi * 288 * Time))
# The sum of the tones and the tones.
OUT <- measureOrthogonality(cbind(rowSums(Tones), Tones))
round(OUT$cosine, 6)
#> [,1] [,2] [,3] [,4]
#> [1,] 1.000000 0.968364 0.242091 0.060523
#> [2,] 0.968364 1.000000 0.000000 0.000000
#> [3,] 0.242091 0.000000 1.000000 0.000000
#> [4,] 0.060523 0.000000 0.000000 1.000000