Phase difference between two real sinusoids

Greetings,

I’m currently trying to find the phase difference between two real
sinusoids. After looking through the archives of the mailing list, I
found the following method:

src1_f=your first source of data
src2_f=your second source of data

hilbert_coeffs = gr.firdes.hilbert (27)
filter1 = gr.fir_filter_fcc(1, hilbert_coeffs)
filter2 = gr.fir_filter_fcc(1, hilbert_coeffs)
fg.connect(self.src1_f, self.filter1)
fg.connect(self.src2_f, self.filter2)

mult=gr.multiply_cc()
c2conj=gr.conjugate_cc()
c2arg=gr.complex_to_arg()

fg.connect(filter1,(mult,0))
fg.connect(filter2,c2conj,(mult,1))
fg.connect(mult,c2arg)

avg_alpha=0.01
avg=gr.single_pole_iir_filter_ff ( avg_alpha )
fg.connect(c2arg,avg)

The problem with this method is that I’m starting out with two streams
of floats. I’m using a hilbert filter to turn my signals into complex
values, but when I do this my phase output is always in the range [0,
180] instead of [-180,180]. The magnitude of the phase seems to be
accurate. Does anyone know how I can get around this?

Thanks,
Morgan R.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs