How do I calculate the power density spectrum if the measured phase has a constant drift?
Phase drift detrend with power density
-
Moku:Go
Moku:Go Arbitrary Waveform Generator Moku:Go Data Logger Moku:Go Frequency Response Analyzer Moku:Go Logic Analyzer & Pattern Generator Moku:Go Oscilloscope & Voltmeter Moku:Go PID Controller Moku:Go Spectrum Analyzer Moku:Go Waveform Generator Moku:Go Power Supplies Moku:Go Digital Filter Box Moku:Go FIR Filter Builder Moku:Go Lock-in Amplifier Moku:Go General Moku:Go Logic Analyzer/Pattern Generator Moku:Go Time & Frequency Analyzer Moku:Go Laser Lock Box Moku:Go Phasemeter
-
Moku:Lab
Moku:Lab General Moku:Lab Arbitrary Waveform Generator Moku:Lab Data Logger Moku:Lab Digital Filter Box Moku:Lab FIR Filter Builder Moku:Lab Frequency Response Analyzer Moku:Lab Laser Lock Box Moku:Lab Lock-in Amplifier Moku:Lab Oscilloscope Moku:Lab Phasemeter Moku:Lab PID Controller Moku:Lab Spectrum Analyzer Moku:Lab Waveform Generator Moku:Lab Time & Frequency Analyzer Moku:Lab Logic Analyzer/Pattern Generator
-
Moku:Pro
Moku:Pro Arbitrary Waveform Generator Moku:Pro Data Logger Moku:Pro Frequency Response Analyzer Moku:Pro Oscilloscope Moku:Pro PID Controller Moku:Pro Spectrum Analyzer Moku:Pro Waveform Generator Moku:Pro Lock-in Amplifier Moku:Pro Digital Filter Box Moku:Pro FIR Filter Builder Moku:Pro Phasemeter Moku:Pro Multi-instrument Mode Moku:Pro General Moku:Pro Logic Analyzer/Pattern Generator Moku:Pro Time & Frequency Analyzer
- Python API
- MATLAB API
- Arbitrary Waveform Generator
- Data Logger
- Digital Filter Box
- FIR Filter Builder
- Frequency Response Analyzer
- Laser Lock Box
- Lock-in Amplifier
- Oscilloscope
- Phasemeter
- PID Controller
- Spectrum Analyzer
- Time & Frequency Analyzer
- Waveform Generator
- Logic Analyzer & Pattern Generator
- Multi Instrument Mode
- Moku Cloud Compile
- Moku general
- LabVIEW
In some circumstances, it is not possible to synchronize Moku's onboard clock with the frequency synthesizer in the system, resulting in a constant drift in the measured phase trace. For example, the measured phase is dominated by a 1 Hz drift, obscuring the 1-degree phase modulation.

After the windowing process, the windowed time series almost maintains the shape of the Hann window because the linear drift is dominating.

When performing frequency spectra analysis on a signal with phase drift, the analysis can be dominated by spectral leakage from the drift component.

This spectral leakage caused by the drifting phase can be resolved by removing the trend in the measured phase. This allows the 1 Hz phase modulation to be seen in the calculated phase amplitude spectral density (ASD).

Comparing the detrended ASD with the non-detrended ASD shows that spectral leakage from the drifting phase obscures the actual phase modulations.

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 ASD calculation.