If I understand correctly, dot product between two sinusoids should return zero if they are orthogonal. Since dot product is at the heart of the DFT, we can only clearly compare the frequencies that are multiples of the frequency from the equation: (sample frequency / number of samples). If our sinusoid is not a multiple of this frequency, we get spectral leakage. This all seems fine, but I can't understand why does the dot product return zeros at some non-harmonic frequencies as seen in the third example. Let's suppose we have the following:
Sampling frequency = 512 Hz Number of samples = 512
Our fundamental frequency is then: 512 Hz/512 = 1 Hz, so our DFT bins would represent frequencies from 0, 1, 2, ..., N - 1.
Example 1:
sin1 = real sinusoid with frequency 5 Hz
sin2 = real sinusoid with frequency 5 Hz
Dot product with these two real sinusoids returns 256 as expected.
Example 2:
sin1 = real sinusoid with frequency 5 Hz
sin2 = real sinusoid with frequency 6 Hz
Dot product returns zero as expected.
Example 3:
sin1 = real sinusoid with frequency 5 Hz
sin2 = real sinusoid with frequency 5.5 Hz
Dot returns zero, but I don't understand why. Why do we get zero here instead of a non-zero number that would represent spectral leakage (as the second sinusoid is not a multiple of a fundamental frequency)?
Example 4:
sin1 = real sinusoid with frequency 5 Hz
sin2 = real sinusoid with frequency 5.75 Hz
We get non-zero value, so this works as expected as we get spectral leakage.
Is my understanding wrong?