Reply by Tom October 15, 20032003-10-15

lightmetal wrote:

> 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.
You use a phase-locked -loop - end of story. Tom
Reply by Jerry Avins October 13, 20032003-10-13
lightmetal wrote:
> floating point?
Not necessarily. http://www.dspguru.com/comp.dsp/tricks/alg/dc_block.htm describes the idea, and it can be used to avoid round-off accumulation in many other circumstances. You don't actually need to divide to find the remainder. When multiplying by the reciprocal, say, .25 to divide by 4, get the "quotient" then multiply a copy of it by the "divisor", and subtract [from] the original. The result is the remainder. More involved than a simple multiply, but much easier than DSP dividing. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
> Jerry Avins <jya@ieee.org> wrote in message news:<bmdcih$ddp$2@bob.news.rcn.net>... > >>lightmetal wrote: >> >> >>>I have this working and it sounds decent when I omit the division. >>>When I do the division, I get a great deal of second harmonic >>>distortion. ... >> >>Division produces remainders. What do you do with them? >> >>Jerry
&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by lightmetal October 13, 20032003-10-13
floating point?

Jerry Avins <jya@ieee.org> wrote in message news:<bmdcih$ddp$2@bob.news.rcn.net>...
> lightmetal wrote: > > > I have this working and it sounds decent when I omit the division. > > When I do the division, I get a great deal of second harmonic > > distortion. ... > > Division produces remainders. What do you do with them? > > Jerry
Reply by Jerry Avins October 13, 20032003-10-13
lightmetal wrote:

> I have this working and it sounds decent when I omit the division. > When I do the division, I get a great deal of second harmonic > distortion. ...
Division produces remainders. What do you do with them? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by lightmetal October 12, 20032003-10-12
I have this working and it sounds decent when I omit the division. 
When I do the division, I get a great deal of second harmonic
distortion.  Any ideas what this would indicate?  What is the division
compensating for?

I had to tweak filter bandwidths, gain, etc. to get it to sound this
good.  It is dead quite (even without the squelch turned on) with full
quieting at signal.  I don't even need the AGC.

Thanks.  I still don't have the arctan working.  Maybe some could
comment on the following since the arctan2 function supplied by Analog
Devices seems wrong.  I checked it against matlab:

Arctan2(1,1) = 0.785398163397448
Arctan2(-1,1) = -0.785398163397448
Arctan2(-1,-1) = -2.35619449019234  ADI was positive
Arctan2(1,-1) = 2.35619449019234  ADI was negative

It looks like ADI's version has the sign flipped on the second term?

If both are wrong for this application, what would the correct values
be?


Thanks


"Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message news:<Jcehb.31012$9a7.17205@bignews6.bellsouth.net>...
> "lightmetal" <jehancoc@pacbell.net> wrote in message > news:a95870c1.0310082111.2662d46f@posting.google.com... > > > > 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
Reply by Dirk Bell October 10, 20032003-10-10
"Alasdair" <alasdair.marsh@baesystems.com> wrote in message
news:76988c29.0310100153.61095de1@posting.google.com...
> 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!) >
This would be approximating the derivative by the first difference, which is a good approximation if you are grossly oversampled, otherwise not.
> > 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).
If you really wanted to do this, the commonly performed phase unwrap can be avoided using atan ( (I+jQ)*(I'-j*Q') ), where here I' and Q' are previous samples of I and Q.
> > There are thus other methods which attempts to get exactly the above > result, or a close approximation, by more computationally expedient > means. >
Again, EXACTLY the above result is an approximation.
> > > 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. >
If I' and Q' are the derivatives of I and Q (time aligned to I and Q), rather than the previous samples, then the previous equation is exact.
> 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) >
This equation is back to approximating the derivative by a first difference (also makes adjustment for some possible unintentional AM). The approximation has a 1/2 sample delay that makes the approximate derivatives and original I and Q out of time alignment, which is undesirable. <snipped>
> > Hope that helps. > > Al >
<snipped> Dirk Dirk A. Bell DSP Consultant
Reply by lightmetal October 10, 20032003-10-10
Hello alasdair:

thanks for the response.  Your first sounds the best so far after band
pass filtering the result.  Still not the quality I want/need.

Maybe this will prompt somone:

Prior to the final bandpass filter from 60-2800hz, the signal from the
various non-arctan methods have a strange look using my audio editor. 
It is most noticeable at the end of a transmission when the carrier
drops.  The audio signal stays above dc for a period of about 1.45
seconds, essentially riding a low freq wave.  I notice that the other
audio, though difficult to tell exactly, seems to have a dc component,
though when I automatically try to remove it using the soundforge
audio editor, it states there is not a significant dc component.

The distortion sounds like peak clipping and I can't tell where it is
coming from.  I am using a floating point dsp.  The only possible
clipping would be at output dac but that doesn't seem to be the case
since I can vary the gain lower to avoid this distortion.

My FM signal generator will be here today at a great Fedex expense and
I shoud have a better handle on the distortion.

Thank you for your lengthy note.


alasdair.marsh@baesystems.com (Alasdair) wrote in message news:<76988c29.0310100153.61095de1@posting.google.com>...
> 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 > > quadrant problem. > > > > > > "Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message news:<Jcehb.31012$9a7.17205@bignews6.bellsouth.net>... > > > "lightmetal" <jehancoc@pacbell.net> wrote in message > > > news:a95870c1.0310082111.2662d46f@posting.google.com... > > > > > > > > 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
Reply by Alasdair October 10, 20032003-10-10
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 > quadrant problem. > > > "Clay S. Turner" <physicsNOOOOSPPPPAMMMM@bellsouth.net> wrote in message news:<Jcehb.31012$9a7.17205@bignews6.bellsouth.net>... > > "lightmetal" <jehancoc@pacbell.net> wrote in message > > news:a95870c1.0310082111.2662d46f@posting.google.com... > > > > > > 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
Reply by Matt Boytim October 9, 20032003-10-09
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
Reply by Dirk Bell October 9, 20032003-10-09
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
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. > > 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 > > > news:a95870c1.0310082111.2662d46f@posting.google.com... > > > > > > > > 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 > > > > > > > > > > > >