DSPRelated.com
Forums

FM demodulation phase unwrapping

Started by mans-34 January 29, 2007
Hello,

     I did some simulation to develop an FM demodulator. I used Simulink for 
modeling.



I create a 40 MHZ carrier signal modulated with 1K data signal and sampled 
at 102.4 M sample per cycle.

The signal is then feed into a FIR filter to make IQ signal.

I used Atan and unwrap and differentiator to demodulate the signal and I was 
able to successfully demodulate it.



Now I want to see what the effect is if I down sample the signal.

To do this I down sampled the signal IQ signal by 102 to get approximately a 
signal that is sampled by 1MHZ. I was again success full in demodulation.



I down sampled by 2048 to make the sampling rate 50KHz. Now it seems that 
the "unwrap" doesn't function properly.



How sampling rate effecting unwrapping and how I can solve it?



Best regards



On Jan 29, 9:45 am, "mans-34" <use_my_name_h...@blueyonder.co.uk> 
wrote:
> Hello, > > I did some simulation to develop an FM demodulator. I used Simulink for > modeling. > > I create a 40 MHZ carrier signal modulated with 1K data signal and sampled > at 102.4 M sample per cycle. > > The signal is then feed into a FIR filter to make IQ signal. > > I used Atan and unwrap and differentiator to demodulate the signal and I was > able to successfully demodulate it. > > Now I want to see what the effect is if I down sample the signal. > > To do this I down sampled the signal IQ signal by 102 to get approximately a > signal that is sampled by 1MHZ. I was again success full in demodulation. > > I down sampled by 2048 to make the sampling rate 50KHz. Now it seems that > the "unwrap" doesn't function properly. > > How sampling rate effecting unwrapping and how I can solve it? > > Best regards
You shouldn't need to "unwrap" your phase value, as it shouldn't ever break out of the [-pi, pi] interval. To do FM demodulation by directly deriving the phase of the received signal, you should use an atan2 algorithm: an atan() function that also takes the signs of the I and Q arguments into account so it can determine which quadrant the complex number represented by I + jQ is located in. This will give you an angle that lies in the [-pi, pi] interval that corresponds to the instantaneous phase of the received signal. You would then differentiate this to get the frequency (and therefore the message signal) out. The only way this would change with the sampling rate is in the amount of phase change between adjacent samples. If your numbers are correct, you're still well oversampled at 50 kHz. Did you mix the signal to bring it back down to baseband before you downsampled, or are you trying to sample the bandpass signal appropriately so aliasing isn't an issue? In both cases, do you have appropriate filtering before you sample to avoid aliasing that you don't want? Jason
cincydsp@gmail.com wrote:

   ...

> You shouldn't need to "unwrap" your phase value, as it shouldn't ever > break out of the [-pi, pi] interval. ...
Doesn't that depend on the amount of modulation? I know of nothing inherent in FM (PM, actually) that limits the modulation to any particular range. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;

On Jan 29, 11:43 am, Jerry Avins <j...@ieee.org> wrote:
> cincy...@gmail.com wrote: ... > > > You shouldn't need to "unwrap" your phase value, as it shouldn't ever > > break out of the [-pi, pi] interval. ...Doesn't that depend on the amou=
nt of modulation? I know of nothing
> inherent in FM (PM, actually) that limits the modulation to any > particular range. > > Jerry > -- > Engineering is the art of making what you want from things you can get. > =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF My message was misleading; I should have said that the *frequency*=20 value (or the output of the differentiator after you extract the=20 phase) shouldn't need to be unwrapped, as it shouldn't ever exceed +/-=20 pi; otherwise, you experience aliasing, and you might be observing a=20 different frequency than what's actually there, messing up the=20 magnitude of the frequency detector output. Sure, your deviation can=20 be whatever you want, but what's important is the deviation to sample=20 rate ratio, which, for properly sampled signals, will always lie in=20 the [-pi, pi] interval. Now that I think about it, the interval should probably be (-pi, pi)=20 instead, but it's close enough. Jason

On Jan 29, 12:54 pm, cincy...@gmail.com wrote:
> On Jan 29, 11:43 am, Jerry Avins <j...@ieee.org> wrote: > > My message was misleading; I should have said that the *frequency* > value (or the output of the differentiator after you extract the > phase) shouldn't need to be unwrapped, as it shouldn't ever exceed +/- > pi; otherwise, you experience aliasing, and you might be observing a > different frequency than what's actually there, messing up the > magnitude of the frequency detector output. Sure, your deviation can > be whatever you want, but what's important is the deviation to sample > rate ratio, which, for properly sampled signals, will always lie in > the [-pi, pi] interval. > > Now that I think about it, the interval should probably be (-pi, pi) > instead, but it's close enough.
i think, then we're talking about using the difference formula for arctan(u) - arctan(v) = arctan( (u-v)/(1 + u*v) ) if |arctan(u) - arctan(v)| < pi/2 you can use this to incrementally determine phase that is inherently unwrapped: arg{x[n+1]} = arg{x[n]} + arctan( (Im{x[n+1]}*Re{x[n]} - Re{x[n+1]}*Im{x[n]}) / (Re{x[n+1]}*Re{x[n]} + Im{x[n +1]}*Im{x[n]}) ) where x[n] is your complex IF signal. the instantaneous frequency deviation (radians per sample) is simply f[n] = arg{x[n+1]} - arg{x[n]} = arctan( (Im{x[n+1]}*Re{x[n]} - Re{x[n+1]}*Im{x[n]}) / (Re{x[n+1]}*Re{x[n]} + Im{x[n +1]}*Im{x[n]}) )

geez, i hate this new Google groups.  i used to be able to preview 
messages to see if they wrapped badly (speaking of wrapping).  and it 
doesn't allow modifying the Subject: header in an existing thread.  
talk about lame.  Google is getting worse.  (are they learning from 
the Redmond boys?  i sure hope not.)

what i meant to say is:

unwrapped phase:

    arg{x[n+1]}  =   arg{x[n]}  +

        arctan( (Im{x[n+1]}*Re{x[n]} - Re{x[n+1]}*Im{x[n]})  /
               (Re{x[n+1]}*Re{x[n]} + Im{x[n+1]}*Im{x[n]}) )

where x[n] is your complex IF signal.

the instantaneous frequency deviation (radians per sample) is simply

   f[n] = arg{x[n+1]} - arg{x[n]}

        = arctan( (Im{x[n+1]}*Re{x[n]} - Re{x[n+1]}*Im{x[n]})  /
           (Re{x[n+1]}*Re{x[n]} + Im{x[n+1]}*Im{x[n]}) )


the bastards.

r b-j


cincydsp@gmail.com wrote:
> > On Jan 29, 11:43 am, Jerry Avins <j...@ieee.org> wrote: >> cincy...@gmail.com wrote: ... >> >>> You shouldn't need to "unwrap" your phase value, as it shouldn't ever >>> break out of the [-pi, pi] interval. ...Doesn't that depend on the amount of modulation? I know of nothing >> inherent in FM (PM, actually) that limits the modulation to any >> particular range. >> >> Jerry >> -- >> Engineering is the art of making what you want from things you can get. >> &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; > > My message was misleading; I should have said that the *frequency* > value (or the output of the differentiator after you extract the > phase) shouldn't need to be unwrapped, as it shouldn't ever exceed +/- > pi; otherwise, you experience aliasing, and you might be observing a > different frequency than what's actually there, messing up the > magnitude of the frequency detector output. Sure, your deviation can > be whatever you want, but what's important is the deviation to sample > rate ratio, which, for properly sampled signals, will always lie in > the [-pi, pi] interval. > > Now that I think about it, the interval should probably be (-pi, pi) > instead, but it's close enough.
Yes. The difference of phase between successive sample times is limited. Is that what the OP is calculating? Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
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? Jerry -- Engineering is the art of making what you want from things you can get.

On Jan 29, 1:49 pm, Jerry Avins <j...@ieee.org> wrote:
> cincy...@gmail.com wrote: > > > On Jan 29, 11:43 am, Jerry Avins <j...@ieee.org> wrote: > >> cincy...@gmail.com wrote: ... > > >>> You shouldn't need to "unwrap" your phase value, as it shouldn't ever > >>> break out of the [-pi, pi] interval. ...Doesn't that depend on the am=
ount of modulation? I know of nothing
> >> inherent in FM (PM, actually) that limits the modulation to any > >> particular range. > > >> Jerry > >> -- > >> Engineering is the art of making what you want from things you can get. > >> ??????????????????????????????????????????????????????????????????????? > > > My message was misleading; I should have said that the *frequency* > > value (or the output of the differentiator after you extract the > > phase) shouldn't need to be unwrapped, as it shouldn't ever exceed +/- > > pi; otherwise, you experience aliasing, and you might be observing a > > different frequency than what's actually there, messing up the > > magnitude of the frequency detector output. Sure, your deviation can > > be whatever you want, but what's important is the deviation to sample > > rate ratio, which, for properly sampled signals, will always lie in > > the [-pi, pi] interval. > > > Now that I think about it, the interval should probably be (-pi, pi) > > instead, but it's close enough.Yes. The difference of phase between suc=
cessive sample times is limited.
> Is that what the OP is calculating? > > Jerry > -- > Engineering is the art of making what you want from things you can get. > =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF He indicated that he was using the atan() + differentiator method of=20 demodulating the signal, so yes, I think it is what he is calculating.=20 I just pointed out that he shouldn't need to unwrap the phase at all,=20 if he is getting the phase information from an arctangent function. Jason
"mans-34" <use_my_name_here@blueyonder.co.uk> wrote in message
news:bMnvh.170727$QY6.3423@fe1.news.blueyonder.co.uk...
> Hello, > > I did some simulation to develop an FM demodulator. I used Simulink
for
> modeling. > > > > I create a 40 MHZ carrier signal modulated with 1K data signal and sampled > at 102.4 M sample per cycle. > > The signal is then feed into a FIR filter to make IQ signal. > > I used Atan and unwrap and differentiator to demodulate the signal and I
was
> able to successfully demodulate it. > > > > Now I want to see what the effect is if I down sample the signal. > > To do this I down sampled the signal IQ signal by 102 to get approximately
a
> signal that is sampled by 1MHZ. I was again success full in demodulation. > > > > I down sampled by 2048 to make the sampling rate 50KHz. Now it seems that > the "unwrap" doesn't function properly. > > > > How sampling rate effecting unwrapping and how I can solve it? > > > > Best regards > >
If you have I and Q you don't need atan at all. Use (IQ'-QI')/(I^2+Q^2) where ' is differentiate. F. -- Posted via a free Usenet account from http://www.teranews.com