[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Angle manipulation & other concerns
From: |
Martin Dvh |
Subject: |
Re: [Discuss-gnuradio] Angle manipulation & other concerns |
Date: |
Mon, 20 Feb 2006 09:56:52 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030823 |
joe j wrote:
Hi Everyone,
I have two sets of data collected from the usrp board and now I'm
trying to subtract the angle of the first data to the angle of the
second data. I was thinking to use gr.complex_to_arg() to get the angle
values from both data then just subtract one from the other, but now I
don't know if there is a way to put the modified angle back with
the first data's magnitude. Are there any existing functions to do this?
What I do to get an angle difference is the following:
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)
To put the angle back into one of the signals you could use the output of mult
(before the c2arg)
remove the amplitude and multply it with your signal.
What I tried to align the phases of two signals is
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
dummy2=gr.add_const_cc(0.0) #This is just a block which should have the same
delay as c2mag and do nothing further
dummy3=gr.add_const_cc(0.0) #This is just a block which should have the same
delay as f2c and do nothing further
c2mag=gr.complex_to_mag()
f2c=gr.float_to_complex()
div=gr.divide_cc()
fg.connect(src1,dummy,(mult,0))
fg.connect(src2,c2conj,(mult,1))
#now mult contains a complex signal with phase=difference between src1, src2
and amp=amp(src1)*amp(src2)
fg.connect(mult,dummy2,dummy3,(div,0))
fg.connect(mult, c2mag, f2c,(div,1))
#This should eliminate the amplitude of mult (amp should now be 1.0), phase
should still be phase1-phase2
fg.connect(src1,(mult2,0)) #shift the phase of input 1 with the phase
difference found
#actually also needs a could of dummmy blocks to
accound for delays
This works somewhat but is very noisy.
I am working on a phase align block which uses an gr.agc_cc() to get rid of the
amplitude of mult in stead of the divide_by_amplitude trick
(gr.agc_cc is not in cvs yet)
Greetings,
Martin
My other concern is how the data is collected from the usrp board - I
read the tutorial on how the mux works though I still don't understand
it exactly. So if I say something.set_mux(gru.hexint(0x32103210)), what
does that really do?
Thanks,
JC
------------------------------------------------------------------------
Yahoo! Autos <http://us.rd.yahoo.com/evt=38381/
ylc=X3oDMTEzcGlrdGY5BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDMWF1dG9z/*http://autos.yahoo.com/index.html
>. Looking for a sweet ride? Get pricing, reviews, & more on new and
used cars.
------------------------------------------------------------------------
_______________________________________________
Discuss-gnuradio mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio