How do we calculate the phase of a signal with a noninteger period of a signal? For example, if a signal has a frequency of 1kHz and is sampled at 8kHz, 8 samples (1 period) can be used in the FFT or Goertzel to calculate the phase. However, if a signal has a frequency of 900Hz or 1.1kHz and is sampled at 8kHz, then 8 samples (1.11 or 0.909 periods respectively) will produce incorrect phase calculation. How do we compensate for a noninteger sample period?
Do an fftshift (rotate the input vector by N/2) before doing the FFT. Or for a phase measurement at a fixed point in time, start sampling the data earlier so the N/2 time sample in the FFT input vendor is at the time point where you want the measurement, and then flip the sign of the phase of every other bin of the FFT result (the odd numbered ones). This will move the phase reference point to the middle of the data window, where an input sinusoid will not have a discontinuity in phase that changes with frequency. This also allows interpolation of phase between FFT result bins.
The evenness/oddness ratio, and thus the FFT phase, does not change with frequency when a sinusoid's phase is referenced to (for example both generated at and measured with respect to) the center of the FFT aperture.