How do I calculate the power density spectrum if the measured phase has a constant drift?
Phase drift detrend with power density
In some circumstances, it's not possible to synchronize Moku:Lab onboard clock with the frequency synthesizer in the system. The measured phase trace has a constant drift.
This can be fixed by a linear detrend process before the power spectrum density (PSD) calculation. In Python, the detrend can be performed by adding a detrend='constant' option in the scipy.signal.welch function. In MATLAB, a similar process can be done with a first-order detrend function, before the PSD calculation.