pythonsignalssignal-processinggnuradiophase

How to calculate the Phase difference between two signal sources in GNU Radio


I am trying to calculate the phase difference between two signals, a sine wave and a cosine wave, using GNU Radio. I am using the following block configuration: enter image description here

The problem is that I am not getting the desired output in the time sink block. I just see a constant signal with amplitude of 0 not changing over time.

enter image description here

Is my block configuration to calculate the phase difference between the two signals right?


Solution

  • As documented in the official Block documentation,

    Sine

    • Real-valued signal types: Amplitude·sin(2π·Frequency/Sample Rate·n) + Offset
    • Complex-valued signal types: Amplitude·[cos(2π·Frequency/Sample Rate·n) + 1j·sin(2π·Frequency/Sample Rate·n)] + Offset

    Cos

    • Real-valued signal types: Amplitude·cos(2π·Frequency/Sample Rate·n) + Offset
    • Complex-valued signal types (identical to Sin): Amplitude·cos(2π·Frequency/Sample Rate·n) + 1j·sin(2π·Frequency/Sample Rate·n) + Offset

    (emphasis mine)

    So, this isn't surprising - you're multiplying exp(j·something) with its own conjugate all the time, getting a constant exp(j·0) = 1, which has argument 0.

    Try changing the initial phase of either of these!