# FM demodulation help needed

Started by October 9, 2003
```Since everyone was so helpful with my AM problem, how about helping
with FM?

I have I/Q at baseband.  I am not using an IF but translating to 0hz,
with sin/cos in hardware using a quad dds. Could this be a problem due
to not getting the entire signal since the frequencies around 0hz are
filtered and I obviously don't have a DC component??.

I have tried the arctan(i/q) followed by a 1 tap differentiator and a
low pass filter.  This has the same results as:

y(n) = [ -I(n)*Q(n-1) + Q(n)*I(n-1) ]/[ I(n)^2 + Q(n)^2 ]

and the similar Frerking method.

I get a great deal of distortion and the signal is unintelligible,
sounds like a buzzing or overload.

I am using 48khz sample rate.  Since the above methods are failing and
sound alike it leads me to believe it is after the FM detection in the
low pass filter??

Any help is always appreciated.
```
```"lightmetal" <jehancoc@pacbell.net> wrote in message
>
> I have tried the arctan(i/q) followed by a 1 tap differentiator and a
> low pass filter.  This has the same results as:
>
>  y(n) = [ -I(n)*Q(n-1) + Q(n)*I(n-1) ]/[ I(n)^2 + Q(n)^2 ]
>
> and the similar Frerking method.
>
> I get a great deal of distortion and the signal is unintelligible,
> sounds like a buzzing or overload.
>

Hello "lightmetal",

It appears that you followed Frerking's version where his equation (6.76)
has an error. It should be

I(n)* Q'(n) - Q(n)*I'(n)
-----------------------   = omega
I^2(n) + Q^2(n)

Frerking has the derivative term on just the Q(n) term in his equation.

This should help a bit.

Clay

```
```Frerking equation is also for atan(q/i) rather than the atan(i/q)
'lightmetal' mentioned. Not a big deal, but a little different result.

However, what Frerking mentions in the text, but does not show up in the
equations, is that I' and Q' must be time aligned with I and Q, so any delay
in the differentiator must be compensated for. That is a big deal.

Dirk

Dirk A. Bell
DSP Consultant

"Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message
news:Jcehb.31012\$9a7.17205@bignews6.bellsouth.net...
>
> "lightmetal" <jehancoc@pacbell.net> wrote in message
> >
> > I have tried the arctan(i/q) followed by a 1 tap differentiator and a
> > low pass filter.  This has the same results as:
> >
> >  y(n) = [ -I(n)*Q(n-1) + Q(n)*I(n-1) ]/[ I(n)^2 + Q(n)^2 ]
> >
> > and the similar Frerking method.
> >
> > I get a great deal of distortion and the signal is unintelligible,
> > sounds like a buzzing or overload.
> >
>
> Hello "lightmetal",
>
> It appears that you followed Frerking's version where his equation (6.76)
> has an error. It should be
>
> I(n)* Q'(n) - Q(n)*I'(n)
> -----------------------   = omega
>  I^2(n) + Q^2(n)
>
>
> Frerking has the derivative term on just the Q(n) term in his equation.
>
>
> This should help a bit.
>
> Clay
>
>
>
>

```
```How about...

(1) Amplitude limiting the digitized FM signal.
(2) Passing them through a frequency discriminator ( a filter whose
transition band is linear and wide enough to span the delta F of the FM
signal)

Now you have an AM signal.
(3) Envelope detecting or LP Filtering to extract the original signal.

"Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message
news:Jcehb.31012\$9a7.17205@bignews6.bellsouth.net...
>
> "lightmetal" <jehancoc@pacbell.net> wrote in message
> >
> > I have tried the arctan(i/q) followed by a 1 tap differentiator and a
> > low pass filter.  This has the same results as:
> >
> >  y(n) = [ -I(n)*Q(n-1) + Q(n)*I(n-1) ]/[ I(n)^2 + Q(n)^2 ]
> >
> > and the similar Frerking method.
> >
> > I get a great deal of distortion and the signal is unintelligible,
> > sounds like a buzzing or overload.
> >
>
> Hello "lightmetal",
>
> It appears that you followed Frerking's version where his equation (6.76)
> has an error. It should be
>
> I(n)* Q'(n) - Q(n)*I'(n)
> -----------------------   = omega
>  I^2(n) + Q^2(n)
>
>
> Frerking has the derivative term on just the Q(n) term in his equation.
>
>
> This should help a bit.
>
> Clay
>
>
>
>

```
```Prasanna Kumar Ganta wrote:

>
> (1) Amplitude limiting the digitized FM signal.
> (2) Passing them through a frequency discriminator ( a filter whose
> transition band is linear and wide enough to span the delta F of the FM
> signal)
>
>  Now you have an AM signal.
> (3) Envelope detecting or LP Filtering to extract the original signal.
>

That works (of course) in the continuous case, but it breaks for sampled
systems down unless the carrier is sufficiently oversampled. The same is
true when using a peak- or average detector to demodulate AM (Peak works
best with enough oversampling, while average is more forgiving of low
oversampling ratios.) Sub-band sampling excepted.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;

```
```Clay,  I found the Frerking error (no pun intended).

I have move farther by using an IF of 12khz.  This takes out a great
deal of the distortion on the defferentiator method though I still
can't get the arctan to work.  I am using arctan2 so it isn't a

"Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message news:<Jcehb.31012\$9a7.17205@bignews6.bellsouth.net>...
> "lightmetal" <jehancoc@pacbell.net> wrote in message
> >
> > I have tried the arctan(i/q) followed by a 1 tap differentiator and a
> > low pass filter.  This has the same results as:
> >
> >  y(n) = [ -I(n)*Q(n-1) + Q(n)*I(n-1) ]/[ I(n)^2 + Q(n)^2 ]
> >
> > and the similar Frerking method.
> >
> > I get a great deal of distortion and the signal is unintelligible,
> > sounds like a buzzing or overload.
> >
>
> Hello "lightmetal",
>
> It appears that you followed Frerking's version where his equation (6.76)
> has an error. It should be
>
> I(n)* Q'(n) - Q(n)*I'(n)
> -----------------------   = omega
>  I^2(n) + Q^2(n)
>
>
> Frerking has the derivative term on just the Q(n) term in his equation.
>
>
> This should help a bit.
>
> Clay
```
```Dirk,
As my earlier post will state, I've been able to move forward by using
an IF.

On you recommendation, how can I' and I or Q' and Q be time aligned if
they are z-1?  Or are you referring to I' and Q'?

I have that algorithm working but there is still a lot of distortion.
I am still having trouble with the arctan2(Q/I).

Thanks

"Dirk Bell" <dirkman@erols.com> wrote in message news:<bm46fb\$s6s\$1@bob.news.rcn.net>...
> Frerking equation is also for atan(q/i) rather than the atan(i/q)
> 'lightmetal' mentioned. Not a big deal, but a little different result.
>
> However, what Frerking mentions in the text, but does not show up in the
> equations, is that I' and Q' must be time aligned with I and Q, so any delay
> in the differentiator must be compensated for. That is a big deal.
>
> Dirk
>
> Dirk A. Bell
> DSP Consultant
>
>
> "Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message
> news:Jcehb.31012\$9a7.17205@bignews6.bellsouth.net...
> >
> > "lightmetal" <jehancoc@pacbell.net> wrote in message
> > >
> > > I have tried the arctan(i/q) followed by a 1 tap differentiator and a
> > > low pass filter.  This has the same results as:
> > >
> > >  y(n) = [ -I(n)*Q(n-1) + Q(n)*I(n-1) ]/[ I(n)^2 + Q(n)^2 ]
> > >
> > > and the similar Frerking method.
> > >
> > > I get a great deal of distortion and the signal is unintelligible,
> > > sounds like a buzzing or overload.
> > >
> >
> > Hello "lightmetal",
> >
> > It appears that you followed Frerking's version where his equation (6.76)
> > has an error. It should be
> >
> > I(n)* Q'(n) - Q(n)*I'(n)
> > -----------------------   = omega
> >  I^2(n) + Q^2(n)
> >
> >
> > Frerking has the derivative term on just the Q(n) term in his equation.
> >
> >
> > This should help a bit.
> >
> > Clay
> >
> >
> >
> >
```
```Lightmetal,

If you don't want to mess with the sample rates you need a differentiator
with an odd number of taps so I and Q can be delayed by an integer number of
samples to align with I' and Q'. I' and Q' are the derivatives of I and Q,
respectively.

I am not sure what you mean by "if they are z-1?". Are you assuming
I'=(z-1)*I ?

Dirk

Dirk A. Bell
DSP Consultant

"lightmetal" <jehancoc@pacbell.net> wrote in message
> Dirk,
> As my earlier post will state, I've been able to move forward by using
> an IF.
>
> On you recommendation, how can I' and I or Q' and Q be time aligned if
> they are z-1?  Or are you referring to I' and Q'?
>
> I have that algorithm working but there is still a lot of distortion.
> I am still having trouble with the arctan2(Q/I).
>
> Thanks
>
>
> "Dirk Bell" <dirkman@erols.com> wrote in message
news:<bm46fb\$s6s\$1@bob.news.rcn.net>...
> > Frerking equation is also for atan(q/i) rather than the atan(i/q)
> > 'lightmetal' mentioned. Not a big deal, but a little different result.
> >
> > However, what Frerking mentions in the text, but does not show up in the
> > equations, is that I' and Q' must be time aligned with I and Q, so any
delay
> > in the differentiator must be compensated for. That is a big deal.
> >
> > Dirk
> >
> > Dirk A. Bell
> > DSP Consultant
> >
> >
> > "Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message
> > news:Jcehb.31012\$9a7.17205@bignews6.bellsouth.net...
> > >
> > > "lightmetal" <jehancoc@pacbell.net> wrote in message
> > > >
> > > > I have tried the arctan(i/q) followed by a 1 tap differentiator and
a
> > > > low pass filter.  This has the same results as:
> > > >
> > > >  y(n) = [ -I(n)*Q(n-1) + Q(n)*I(n-1) ]/[ I(n)^2 + Q(n)^2 ]
> > > >
> > > > and the similar Frerking method.
> > > >
> > > > I get a great deal of distortion and the signal is unintelligible,
> > > > sounds like a buzzing or overload.
> > > >
> > >
> > > Hello "lightmetal",
> > >
> > > It appears that you followed Frerking's version where his equation
(6.76)
> > > has an error. It should be
> > >
> > > I(n)* Q'(n) - Q(n)*I'(n)
> > > -----------------------   = omega
> > >  I^2(n) + Q^2(n)
> > >
> > >
> > > Frerking has the derivative term on just the Q(n) term in his
equation.
> > >
> > >
> > > This should help a bit.
> > >
> > > Clay
> > >
> > >
> > >
> > >

```
```jehancoc@pacbell.net (lightmetal) wrote in message news:<a95870c1.0310091329.40e0905a@posting.google.com>...
> Dirk,
> As my earlier post will state, I've been able to move forward by using
> an IF.

I'm not sure why dc is being filtered off by your ddc, but otherwise
this should work at complex baseband.

> On you recommendation, how can I' and I or Q' and Q be time aligned if
> they are z-1?  Or are you referring to I' and Q'?

I,Q,I',Q' need to all be of the same instant.  A misalignment in time
can be interpretted as an error in the approximation to the continuous
derivative.  That is, I can say I(n)-I(n-1) approximates I'(n) and
then look at the approximation error, although it is a better
approximation to I'(n-.5).  This was discussed in another thread some
time ago - I think it was Clay that provided some very good insight.

> I have that algorithm working but there is still a lot of distortion.
> I am still having trouble with the arctan2(Q/I).

The phase derivative following atan2 needs to wrap at +/- 180 degrees
(return the principal value), otherwise you'll have 360 degree steps
in the detected frequency.

Matt
```
```I've recently been round the bouy on this, so please accept my
somewhat hurried response, there could be a few missing - signs etc!
Anyway pick holes in the below.

Remembering that what you are trying to compute is the instantaneous
frequency, which is the derivative of the instantaneous phase. The
basic formula is:

F = d(phase) / dt

Taking phase = atan(I/Q)

F = atan(I/Q) - atan(I/Q)'
------------------------
sample interval

(where n' is the previous result n, not the derivative!)

As the sample time is fixed we can ignore the sample interval and just
compute the first difference:

F = atan(I/Q) - atan(I/Q)'

and this is our result.

However, this can be awkward to compute as we need to unwrap the phase
in some way and a look up table to implement atan will be big, and
there may not be time to computing trig function on the fly (although
note that we do not necessarily always need to start from scratch for
each power series).

There are thus other methods which attempts to get exactly the above
result, or a close approximation, by more computationally expedient
means.

I you are struggling for SNR, I believe that

> > I(n)* Q'(n) - Q(n)*I'(n)
> > -----------------------   = omega
> >  I^2(n) + Q^2(n)
> >

is an approximation, and assumes that the current and next values of I
and Q are approximately the same.

For better SNR I use.

F =        Q*(I-I') - I*(Q-Q')
-----------------------------
sqrt(I*I+Q*Q)*sqrt(I'*I'+Q'*Q')

(where I' is the previous I sample)

If it better fits your target implementation you can cut down on the
number of square roots, and use:
=   sqrt( (I*I')^2 + (I*Q')^2 + (Q*I')^2 + (Q*Q')^2 )
as the denominator.

Depending on the different costs for different types of function in
your target, you can also use a function based on asin.

F=                  asin([Q'*I - Q*I']
-------------------------------------------------
sqrt( (I*I')^2 + (I*Q')^2 + (Q*I')^2 + (Q*Q')^2 )

The advantage of this over atan is that asin has a bounded input range
and so can more easily be implemented in a small lookup table.

Also, if your chasing SNR remember to filter the output to the
bandwidth of the original modulation signal.

Hope that helps.

Al

jehancoc@pacbell.net (lightmetal) wrote in message news:<a95870c1.0310091126.631c7f3e@posting.google.com>...
> Clay,  I found the Frerking error (no pun intended).
>
> I have move farther by using an IF of 12khz.  This takes out a great
> deal of the distortion on the defferentiator method though I still
> can't get the arctan to work.  I am using arctan2 so it isn't a
>
>
> "Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message news:<Jcehb.31012\$9a7.17205@bignews6.bellsouth.net>...
> > "lightmetal" <jehancoc@pacbell.net> wrote in message
> > >
> > > I have tried the arctan(i/q) followed by a 1 tap differentiator and a
> > > low pass filter.  This has the same results as:
> > >
> > >  y(n) = [ -I(n)*Q(n-1) + Q(n)*I(n-1) ]/[ I(n)^2 + Q(n)^2 ]
> > >
> > > and the similar Frerking method.
> > >
> > > I get a great deal of distortion and the signal is unintelligible,
> > > sounds like a buzzing or overload.
> > >
> >
> > Hello "lightmetal",
> >
> > It appears that you followed Frerking's version where his equation (6.76)
> > has an error. It should be
> >
> > I(n)* Q'(n) - Q(n)*I'(n)
> > -----------------------   = omega
> >  I^2(n) + Q^2(n)
> >
> >
> > Frerking has the derivative term on just the Q(n) term in his equation.
> >
> >
> > This should help a bit.
> >
> > Clay
```