DSPRelated.com
Forums

phase to group delay

Started by kaz September 30, 2012
I designed an algorithm to compute signal delay through an RF channel. 
I first verified the algorithm using a known IIR model. I managed to get 
groupdelay of this IIR spot on compared to that given by Matlab function 
grpdelay(num,den). The algorithm is based on sending frequency sweep chirp

signal followed by fft then conversion of phase to groupdelay using the 
derivative of negative angular phase with respect to angular frequency.

The algorithm has been released and is working well. I am now asked if I 
could apply it to the case when the available test signal is only single 
tone instead of frequency sweep.

I tested my same algorithm on single tone. All looks ok but with a mystery

factor of 2 needed to get IIR model groupdelay match that of matlab. I 
mean if I multiply the computed groupdelay based on fft by 2 then it gets 
correct with a small margin of error.

Any idea what this factor of 2 might be. In both cases I use real only 
chirp signal or real only single tone and the fft is complex. Processing 
is identical throughout the algorithm for both cases in every step.

Regards

Kadhiem






kaz <37480@dsprelated> wrote:

> I designed an algorithm to compute signal delay through an RF channel. > I first verified the algorithm using a known IIR model. I managed to get > groupdelay of this IIR spot on compared to that given by Matlab function > grpdelay(num,den). The algorithm is based on sending frequency sweep chirp > signal followed by fft then conversion of phase to groupdelay using the > derivative of negative angular phase with respect to angular frequency.
In optics, phase velocity is w/k, group velocity dw/dk. I think you can derive phase delay and group delay from that.
> The algorithm has been released and is working well. I am now asked if I > could apply it to the case when the available test signal is only single > tone instead of frequency sweep.
I don't see how you get the derivative from a single tone. If you mean more than one single tone, then I might agree.
> I tested my same algorithm on single tone. All looks ok but with a mystery
-- glen
On Sunday, September 30, 2012 8:26:19 PM UTC+2, kaz wrote:
> I designed an algorithm to compute signal delay through an RF channel. > > I first verified the algorithm using a known IIR model. I managed to get > > groupdelay of this IIR spot on compared to that given by Matlab function > > grpdelay(num,den). The algorithm is based on sending frequency sweep chirp > > > > signal followed by fft then conversion of phase to groupdelay using the > > derivative of negative angular phase with respect to angular frequency. > > > > The algorithm has been released and is working well. I am now asked if I > > could apply it to the case when the available test signal is only single > > tone instead of frequency sweep. > > > > I tested my same algorithm on single tone. All looks ok but with a mystery > > > > factor of 2 needed to get IIR model groupdelay match that of matlab. I > > mean if I multiply the computed groupdelay based on fft by 2 then it gets > > correct with a small margin of error. > > > > Any idea what this factor of 2 might be. In both cases I use real only > > chirp signal or real only single tone and the fft is complex. Processing > > is identical throughout the algorithm for both cases in every step. > > > > Regards > > > > Kadhiem
like glen lead you to, you can only measure a phase delay with a single tone
<kelvin.bitnick@gmail.com> wrote in message 
news:45edd89c-0639-4c80-ab1d-e9472aa8d7bd@googlegroups.com...
> On Sunday, September 30, 2012 8:26:19 PM UTC+2, kaz wrote: >> I designed an algorithm to compute signal delay through an RF channel. >> I first verified the algorithm using a known IIR model. I managed to get >> groupdelay of this IIR spot on compared to that given by Matlab function >> grpdelay(num,den). The algorithm is based on sending frequency sweep >> chirp >> signal followed by fft then conversion of phase to groupdelay using the >> derivative of negative angular phase with respect to angular frequency. >> >> The algorithm has been released and is working well. I am now asked if I >> could apply it to the case when the available test signal is only single >> tone instead of frequency sweep. >> >> >> I tested my same algorithm on single tone. All looks ok but with a >> mystery >> factor of 2 needed to get IIR model groupdelay match that of matlab. I >> mean if I multiply the computed groupdelay based on fft by 2 then it gets >> correct with a small margin of error. >> >> >> Any idea what this factor of 2 might be. In both cases I use real only >> chirp signal or real only single tone and the fft is complex. Processing >> is identical throughout the algorithm for both cases in every step.
Matlabi apparently messed phase unwrapping.
> like glen lead you to, you can only measure a phase delay with a single > ton
You two simpletones could figure out that delay could be measured with a burst of simple tone. VLV
>> Matlabi apparently messed phase unwrapping.
sounds only too familiar. To -track- a phase from zero across the frequency axis, I need signal energy everywhere in-between. If the signal is bandpass-type - such as single tone - it's often not possible at all to resolve the phase ambiguity without side information. See the end of page here: http://www.dsprelated.com/showarticle/26.php section "phase unwrapping" for this particular problem.
>>> Matlabi apparently messed phase unwrapping. > >sounds only too familiar. >To -track- a phase from zero across the frequency axis, I need signal >energy everywhere in-between. >If the signal is bandpass-type - such as single tone - it's often not >possible at all to resolve the phase ambiguity without side information. > >See the end of page here: >http://www.dsprelated.com/showarticle/26.php >section "phase unwrapping" for this particular problem. >
Just to add up more information. In my design I do ratio of output fft to input fft. Thus I have in effect two tones to compare(input and output). Then convert instantaneous phase difference of fft ratio to delay. I might as well look at time domain but it is rather inconsistent and less accurate.
"kaz" <37480@dsprelated> wrote in message 
news:8eGdndSNPfCLT_TNnZ2dnUVZ_qSdnZ2d@giganews.com...

>>>> Matlabi apparently messed phase unwrapping. >> > Just to add up more information. In my design I do ratio of output fft to > input fft. Thus I have in effect two tones to compare(input and output). > Then convert instantaneous phase difference of fft ratio to delay.
Standard mistake. By computing the ratio of FFTs you are running into zero divided by zero problem.
> I might as well look at time domain but it is rather inconsistent and less > accurate.
Then you do it in the wrong way. Since input is the same, the result must be the same. VLV
but if you look only at a single frequency, how could you tell whether,
say, 5 degrees phase difference are really 5 degrees, or 365 degrees, or
725 degrees? 

On 10/1/12 2:54 PM, mnentwig wrote:
> but if you look only at a single frequency, how could you tell whether, > say, 5 degrees phase difference are really 5 degrees, or 365 degrees, or > 725 degrees?
simple phase unwrapping basically insists that the magnitude of the phase difference between adjacent bins in the DFT must be pi radians or less. so it will add whatever integer multiple of 2*pi necessary to make that transition 5 degrees rather than 365. i would instead calculate the delta phase *first*, between adjacent bins and accumulate those deltas to get an unwrapped phase for calculating phase delay. for group delay, it's based on the deltas in the first place, so phase unwrapping is not necessary. that delta is: arg{ X[k+1] } - arg{ X[k] } = arg{ X[k+1]/X[k] } X[k+1]/X[k] = (Re{X[k+1]} + j*Im{X[k+1]}) / (Re{X[k]} + j*Im{X[k]}) work out the math from there. start out from X[0] which will have phase of 0 if the DC component is positive and a phase of + or - pi for negative phase. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
"mnentwig" <24789@dsprelated> wrote in message 
news:mMqdnVI5r7x6e_TNnZ2dnUVZ_oidnZ2d@giganews.com...
> but if you look only at a single frequency, how could you tell whether, > say, 5 degrees phase difference are really 5 degrees, or 365 degrees, or > 725 degrees?
Not a single frequency. A burst of a sine wave, like in classic monopulse radar.