Eric Blossom wrote:
> On Mon, Feb 20, 2006 at 09:56:52AM +0100, Martin Dvh wrote:
> 
>>joe j wrote:
>>
>>
>>src1=your first source of complex data
>>src2=your second source of complex data
>>mult=gr.multiply_cc()
>>c2conj=gr.conjugate_cc()
>>dummy=gr.add_const_cc(0.0) #This is just a block which should have the same 
>>delay as c2conj and do nothing further
>>c2arg=gr.complex_to_arg()
>>fg.connect(src1,dummy,(mult,0))
>>fg.connect(src2,c2conj,(mult,1)
>>fg.connect(mult,c2arg)
>>
>>Now the output of c2arg should have the angle of the phase difference 
>>between your two signals.
>>You could put an average block after that to filter the phase difference
>>avg_alpha=0.01
>>avg=gr.single_pole_iir_filter_ff  (  avg_alpha )
>>fg.connect(c2arg,avg)
>>
>>explanation:
>>If you multiply a signal with the conjugate of another complex signal, the 
>>output is a complex signal with amplitude=amp1*amp2 and phase=phase1-phase2
>>This is why you get a real signal if you multiply a signal with the 
>>conjugate of itsself.
> 
> 
>>The dummy in the above script is just a hack so every path has the same 
>>(processing) delay.  To do this the "right" way you should put all
>>this in one processing block.  (That is the only way to be sure
>>everything has the same processing delay) 
> 
> 
> FYI, you don't need the dummy block.
Is this allways the case?
I allways assumed there could be an arbitrary delay for every processing blocks 
because there are allways buffers inbetween.
Or is it only the delay inside the block that counts (so only fir-like blocks 
have a delay)

Greetings,
Martin
> 
> Just use
> 
>   src1=your first source of complex data
>   src2=your second source of complex data
>   c2conj=gr.conjugate_cc()
>   mult=gr.multiply_cc()
>   c2arg=gr.complex_to_arg()
> 
>   fg.connect(src1, (mult,0))
>   fg.connect(src2, c2conj, (mult,1)
>   fg.connect(mult, c2arg)
> 
> Eric
> 



_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to