I have a real signal comprised of 8 frequencies 400Hz-680Hz in 40Hz increments. The signal is generated from 8 cosines of equal amplitude (A=1) and phase (Phase= 0rad), summed together. This signal is fed through a transmitter to a receiver, and on the receiving end I wish to recover the frequencies and phases of each component. My transmit and receive sample rate is 48kHz. I have verified that I can recover the phase and frequency when I feed directly from the "generation" algorithm to the "processing" algorithm without passing through the tx->rx cycle. I am using FFTW3 in C++.
I have a DFT on the receive-side which correctly identifies the 8 component frequencies with great reliability and accuracy. The FFT length is 1200.
What's not Working
When I try to derive the phase, (I'm using std::arg() in C++), the phases are all over the place, and I do not get what I expect.
What I've Tried
I understand that when I recover the signal at the receiver, I don't have a perfect starting sampling point as I do when I cut the tx->rx cycle out. I've tried "sliding" my DFT window along the signal to try finding the place where the 400Hz component's phase is 0rad as I expect, but even when I find "windows" where the phase for 400Hz is correct, the other phases are goofy and make no sense.
Example output from my receiver
--------------- ITER 23 --------------- 400Hz @ -0.582348 degs 440Hz @ -117.297 degs 480Hz @ 136.052 degs 520Hz @ 36.7404 degs 560Hz @ -59.7696 degs 600Hz @ -152.054 degs 640Hz @ 118.413 degs 680Hz @ 30.3169 degs
Dropping down to two tones gives a similar result, although a pattern emerges. While moving the DFT window along the samples one-by-one, every 1200th iteration of this action shows the periodicity, and the phase is not off by much. This makes sense as every 1200 sample window should be identical over the whole signal sample.
<snipped> --------------- ITER 3411 --------------- 400Hz @ 0.102598 degs 440Hz @ -5.95263 degs --------------- ITER 4611 --------------- 400Hz @ -0.277188 degs 440Hz @ -6.18412 degs --------------- ITER 5811 --------------- 400Hz @ -0.270323 degs 440Hz @ -6.75208 degs
How can I reliably recover the phase from this complex signal? Is there anything wrong with my approach? What would a better approach be if so? Any other inputs are appreciated.