DSPRelated.com
Forums

FM demodulation phase unwrapping

Started by mans-34 January 29, 2007

On Jan 29, 3:36 pm, "mans-34" <use_my_name_h...@blueyonder.co.uk> 
wrote:
> > > r b-j Thanks for your suggestion. I tried this technique and unfortunately it is > not working!
hmmm. it is possible that the phase changes by more than pi/2 radians in a single sample?
> The code that I used is as follow: (In matlab) > > for n=1:length(i_data)-1 > > dif(n)=(q_data(n+1)*i_data(n) - i_data(n+1)*q_data(n)) / (i_data(n+1) * > q_data(n) + q_data(n+1)*q_data(n)); > > end > > angle=atan(dif);
actually, MATLAB has an angle function which they define as angle(z) = imag(log(z)) or angle(z) = atan2(imag(z),real(z)) for complex z. so try it with a different vector name than "angle" since it is a keyword in MATLAB. if it still is a problem, try delta_angle(n) = atan2( (q_data(n+1)*i_data(n) - i_data(n +1)*q_data(n)), \ (i_data(n+1)*q_data(n) + q_data(n+1)*q_data(n)) ); if that doesn't do it right, i have no idea what to do.
> ps: It is not good to attach image files to the posts. Where can I place > them so others can see them?
i have no idea. i dunno, maybe upload it to Wikipedia, but it's against policy and they'll eventually delete them if they don't go into an article.

On Jan 29, 1:54 pm, Jerry Avins <j...@ieee.org> wrote:
> robert bristow-johnson wrote: > > > geez, i hate this new Google groups. i used to be able to preview > > messages to see if they wrapped badly (speaking of wrapping). I recall that there is a way. Do you want me to figure it out again, or > is that enough? >
yeah, could you check that out, Jerry? i can't figger it out. (and it really is crapping up anything i type in with "ASCII math".) r b-j
robert bristow-johnson wrote:
> > On Jan 29, 1:54 pm, Jerry Avins <j...@ieee.org> wrote: >> robert bristow-johnson wrote: >> >>> geez, i hate this new Google groups. i used to be able to preview >>> messages to see if they wrapped badly (speaking of wrapping). I recall that there is a way. Do you want me to figure it out again, or >> is that enough? >> > > yeah, could you check that out, Jerry? i can't figger it out. (and > it really is crapping up anything i type in with "ASCII math".)
I did. I went to Googls and nothing was familiar. I posted a reply to that effect, but I see it isn't here. I guess I haven't yet learned how to hit "Send". Jerry -- Engineering is the art of making what you want from things you can get.
mans-34 wrote:

> dif(n)=(q_data(n+1)*i_data(n) - i_data(n+1)*q_data(n)) / > (i_data(n+1) * q_data(n) + q_data(n+1)*q_data(n));
The first 'q' in the denominator should be an 'i'.
> angle=atan(dif);
According to rbj's formula, a better name for this variable might be angledif or something.
> ps: It is not good to attach image files to the posts. Where can > I place them so others can see them?
http://www.google.com/search?q=image+hosting+free Martin -- Quidquid latine scriptum est, altum videtur.
dbell wrote:

> Vladimir, > > The phase wrapping is not around 0, it is around pi and -pi. > > Dirk > > > On Jan 29, 3:14 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > wrote: > >>dbell wrote: >> >>>Jason, >> >>>Even if the phase change between samples is very small, if you use >>>atan2 on the I and Q terms (not the ratio with two I and Q terms) >>>there is nothing to prevent a phase discontinuity. For example if the >>>phase progresses from pi-epslon to pi+eplson (the usual small epslon) >>>in one sample the second phase is returned as -pi+epslon and the >>>difference is close to 2*pi, not 2*epslon as desired.The simplest fix to this is using the integers. I.e. representing >> >>(-PI...PI) as 0x800000000...0x7FFFFFFF. The phase wrapping around zero >>is taken care off automatically. >> >>Vladimir Vassilevsky >> >>DSP and Mixed Signal Design Consultant >> >>http://www.abvolt.com > >
Yes, and by remapping the angle into 2's complement binary angle measures (BAMs) as Vladimir has shown so that 0x8000... is equivalent to -pi and 0x7fff... is equivalent to +pi-delta, adding delta to the the most positive value will take care of the wrap for you. Basically, it is taking advantage of the modularity of the 2's complement number system to perform the mod function for you without an explicit operation.