I'm looking again at an FSK demodulator.
Currently using an arctan followed by a derivative which is giving good results. fred harris always recommends:
f ~= (dI * Q - dQ * I) / (I^2 + Q^2).
I've tried this method as well as my current one in simulation and it has always performed poorly in comparison. But perhaps the fault lies in the derivative.
Seems like there was a discussion in this group on derivatives but I haven't found it.
Looks like a good derivative with an odd number of taps would be ideal. Anyone have a link or some good notions?
Mark Napier

Hi Mark,
Yes, it's important that the differentiator not be an "open barn door" for noise. I posted about differentiator noise performance here:
https://www.dsprelated.com/showarticle/1447.php
Here are two differentiators with the same bandwidth (0.178*fs) for 2% response error that have different noise output power for gaussian noise at the input:
b_19tap= [8 -22 -2 46 6 -98 -26 240 315 0 -315 ...
-240 26 98 -6 -46 2 22 -8]/1024; % 19-tap diff. coeffs.
b_7tap= 3/5*[-1 0 16 0 -16 0 1]/16; % Lyons 7-tap diff. coeffs.
ratio= sum(b_7tap.^2)/sum(b_19tap.^2)
ratio_dB= 10*log10(ratio)
The results are:
ratio = 2.2317 ratio_dB = 3.4863
So, the output noise power of the 19-tap differentiator is 3.49 dB lower than that of the 7-tap differentiator. Note the 7-tap Lyons differentiator has better performance than a first-difference or second-difference differentiator.
I designed the 19-tap one using firpm.
-- Neil

Hey Neil,
Good to hear from you. Thanks for replying.
For fred harris' formula, I've tried the second-difference with some success but not as good as the arctan/derivative. I'll try making derivative with a higher cut-off frequency and see if it can match up with the frequency content of the signal. It should be said that I have 4 samples per FSK symbol.
Mark Napier

Mark,
If you need more bandwidth, the 7-tap Lyons differentiator has more bandwidth than a second-difference differentiator and lower noise as well.
Note that when using firpm to design a differentiator, use ftype = 'differentiator'. I found that the slope vs omega of the filter designed using firpm comes out less than 1, but that doesn't really matter.
-- Neil

The other issue with using the derivative formulation is that it is not as accurate as the atan version. Why? Because the first order difference in phase of the message is more accurate than the first order difference of the entire signal. In other words, for sinusoidal messages the atan version gives exact results for the true derivative, whereas this is not true for the derivative formulation you listed. As such, for more complex message signals atan version should show less error.

Out of curiosity, how are you handling the +/-pi boundary issue? If one sample falls on one side of the boundary, and the other sample falls on the other side, wouldn't you wind up with a big spike difference (close to 2pi)? Or are you adjusting the data before the arctan to account for this?

The phase is represented by a number that scales [-1, 1) to represent [-pi, pi). The phase is fixed point so of course it rolls over. If you allow it to roll over and account for that in the fixed point derivative math then the discontinuity is no problem. The derivative of the phase is continuous and there is no need for a window or "click" removal that I see in some articles.

UPDATE: I figured out how to implement these concepts in Gnu Radio (since I cannot program worth anything), and it worked flawlessly. Unfortunately, in Gnu Radio, the only data types allowed for convolution are floating point (either real or complex). When Gnu Radio converts from floats to integers, any values outside of the limits are clipped, not wrapped. However, once the samples are integers, any changes WILL wrap. So I was only able to use a first derivative difference rather than test out Lyons' 7-tap and the 19-tap filters. Regardless, still happy with learning something new!
Here's the Gnu Radio flowgraph I created to demodulate a local FM station, followed by the time and spectral display of the demodulated output. (NOTE: I hope the images come through.)
In the time domain display, there are no spikes as, just as stated, the integers will wrap-around. The baseband spectrum is perfect, showing the L+R, 19 kHz pilot tone, L-R stereo, RDS and a SCA at 67 kHz.
Thanks again for the education!

Put your shades on, cuz the light bulb just clicked on!
Thank you for that explanation!

I used this method in a high-performance intercept receiver years ago. It worked great! The differentiator was not a small number of coefficients and its BW exceeded the bandlimited signal BW so the signal was limited to the linear part of the differentiator.
A couple of comments.
1) A first difference only acts like a differentiator if you are very bandlimited AND grossly oversampled. Otherwise... forget it.
2) I may have missed it, but I did not see any mention that the I and Q signals in the equation have to be delayed by the same delay as the differentiator so the I and Q and their derivatives are time aligned.
Dirk

Your second comment is apt. For a block diagram of the differentiator with the delays shown, see section 13.22 of Understanding Digital Signal Processing, 3rd ed., by Rick Lyons.
Assuming an odd number of differentiator taps, the I and Q inputs to the multipliers can be taken from the center taps of the differentiators.
- Neil