DSPRelated.com
Forums

FSK demod: what filter I'm using?

Started by Andrea Baldoni September 18, 2006
Hello.
I'm a newbie of DSP and I have just wrote the software in C for creating a
FSK modulation (phase coherent, using a soft DDS) and demodulate it.
Actually, I'm using the V.23 modem standard as a start point, so I have
generated a 1300/2100Hz FSK with a bit rate of 1200BPS and sampling rate of
8KHz, wrote it to a file and fed to the demodulator.
The demodulator is composed by two digital filters with 8 taps, a filter
"in-phase" and one "quadrature-phase", for each frequency.
The output is squared, summed with it's quadrature and compared with the
other frequency; I borrowed the idea from a caller ID demodulator and in
this ideal situation (no noise neither distortion added) it's working
perfectly.

So, came to the question: the structure of digital filters is the one of
FIR filters and if I plot the output of a filter, I effectively see that
the FSK signal has the low (or high) component attenuated. The coefficient
I used come from a sinewave of the right frequency, delayed or not of PI/2.

Well, WHY????

I did that without understanding and it's working, but in the three books I
have about digital filters (and also in my research with google),
I didn't found a single FIR with coefficents coming from a sine or cosine
without further processing. It's a kind of "correlation filter" (everything
I found about the matter where related to images and not signals)? It's a
sharp passband filter? What is it???? :) How I should name it?
I think the "in-phase" and "quadrature-phase" is just a way to have good
esteem of the energy, and maybe using more phases could be even better.
The output of the filter seems to be in-phase with the filter coefficients
sine phase and not with the input signal (so using more phases I have a
better shaped energy detection, more or less than, using a rectifier in a
three-phase system, yields to less ripple than a monophase). Is this a
general rule for FIR?
I read it's phase invariant if the coefficients are symmetrical.
Mine are not, even if I could be able to center one of the two sinusoids,
the quadrature one comes asymmetrical...

What's the correct analysis of this filtering process?

Thankyou very much!

Ciao,
 AB

... Andrea Baldoni, 2002: messaggio non protetto da copyright.
Andrea Baldoni wrote:

> Hello. > I'm a newbie of DSP and I have just wrote the software in C for creating a > FSK modulation (phase coherent, using a soft DDS) and demodulate it. > Actually, I'm using the V.23 modem standard as a start point, so I have > generated a 1300/2100Hz FSK with a bit rate of 1200BPS and sampling rate of > 8KHz, wrote it to a file and fed to the demodulator. > The demodulator is composed by two digital filters with 8 taps, a filter > "in-phase" and one "quadrature-phase", for each frequency. > The output is squared, summed with it's quadrature and compared with the > other frequency; I borrowed the idea from a caller ID demodulator and in > this ideal situation (no noise neither distortion added) it's working > perfectly. > > So, came to the question: the structure of digital filters is the one of > FIR filters and if I plot the output of a filter, I effectively see that > the FSK signal has the low (or high) component attenuated. The coefficient > I used come from a sinewave of the right frequency, delayed or not of PI/2. > > Well, WHY???? > > I did that without understanding and it's working, but in the three books I > have about digital filters (and also in my research with google), > I didn't found a single FIR with coefficents coming from a sine or cosine > without further processing. It's a kind of "correlation filter" (everything > I found about the matter where related to images and not signals)? It's a > sharp passband filter? What is it???? :) How I should name it?
Each filter is a matched filter, and you should name them thus. They work so well because a matched filter is the best filter to use to identify a pulse that is neither affected by preceding pulses nor that affects succeeding pulses*. Do a web search for "matched filter" for more information.
> I think the "in-phase" and "quadrature-phase" is just a way to have good > esteem of the energy,
Yes
> and maybe using more phases could be even better.
Not really. There's a notion in detection and estimation theory called a 'sufficient statistic'. Once you have a sufficient statistic in hand, no other information you gain about a signal will tell you more than you already know. You're pretty darn close to one.
> The output of the filter seems to be in-phase with the filter coefficients > sine phase and not with the input signal (so using more phases I have a > better shaped energy detection, more or less than, using a rectifier in a > three-phase system, yields to less ripple than a monophase).
Squaring and adding the two 90-spaced filter outputs should give you a dead steady energy estimate for a single-frequency input. Any ripple that you see will be due to changing from one frequency to another, and from cross-contamination of the filter by the other frequency.
> Is this a > general rule for FIR? > I read it's phase invariant if the coefficients are symmetrical. > Mine are not, even if I could be able to center one of the two sinusoids, > the quadrature one comes asymmetrical... >
It's time invariant if the coefficients don't change over time. Symmetrical coefficients will mean that it's phase linear, which is something else. * In this modulation scheme the current pulse's characteristics _are_ affected by the preceding one, and affect the subsequent one. The analysis gets difficult, so just pretend it doesn't happen, eh? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Tim Wescott wrote:
> Andrea Baldoni wrote: > > > Hello. > > I'm a newbie of DSP and I have just wrote the software in C for creating a > > FSK modulation (phase coherent, using a soft DDS) and demodulate it. > > Actually, I'm using the V.23 modem standard as a start point, so I have > > generated a 1300/2100Hz FSK with a bit rate of 1200BPS and sampling rate of > > 8KHz, wrote it to a file and fed to the demodulator. > > The demodulator is composed by two digital filters with 8 taps, a filter > > "in-phase" and one "quadrature-phase", for each frequency. > > The output is squared, summed with it's quadrature and compared with the > > other frequency; I borrowed the idea from a caller ID demodulator and in > > this ideal situation (no noise neither distortion added) it's working > > perfectly. > > > > So, came to the question: the structure of digital filters is the one of > > FIR filters and if I plot the output of a filter, I effectively see that > > the FSK signal has the low (or high) component attenuated. The coefficient > > I used come from a sinewave of the right frequency, delayed or not of PI/2. > > > > Well, WHY???? > > > > I did that without understanding and it's working, but in the three books I > > have about digital filters (and also in my research with google), > > I didn't found a single FIR with coefficents coming from a sine or cosine > > without further processing. It's a kind of "correlation filter" (everything > > I found about the matter where related to images and not signals)? It's a > > sharp passband filter? What is it???? :) How I should name it? > > Each filter is a matched filter, and you should name them thus. They > work so well because a matched filter is the best filter to use to > identify a pulse that is neither affected by preceding pulses nor that > affects succeeding pulses*. > > Do a web search for "matched filter" for more information. >
The OP says the filter length is 8 taps = 1 msec. The bit period is 0.833 msec. The filter length should match the bit period for a true matched filter, so I'd hesitate to use that term. John
Tim Wescott <tim@seemywebsite.com> wrote:

: Each filter is a matched filter, and you should name them thus.  They 
: work so well because a matched filter is the best filter to use to 
: identify a pulse that is neither affected by preceding pulses nor that 
: affects succeeding pulses*.

Oh, thankyou very much, finally I'm enlightened :)
So, for every shape I have to detect, I could build a matched filter and
obtain good results?

: Do a web search for "matched filter" for more information.

Yes, this time I found something interesting finally.

: > and maybe using more phases could be even better.

: Not really.  There's a notion in detection and estimation theory called 
: a 'sufficient statistic'.  Once you have a sufficient statistic in hand, 
: no other information you gain about a signal will tell you more than you 
: already know.  You're pretty darn close to one.

I will try to go into this theme.

: Squaring and adding the two 90-spaced filter outputs should give you a 
: dead steady energy estimate for a single-frequency input.  Any ripple 
: that you see will be due to changing from one frequency to another, and 
: from cross-contamination of the filter by the other frequency.

This is counter intuitive. I thought the parallel with multiphase continuous
signals has to be effective. Anyway, adding more phases is useless when I
just have to compare which one has major energy. A difference of 1 is
sufficient to win the comparison, so having a perfectly smooth output
is not an advantage. It should anyway be more easily obtained by lowpass
filtering the squared and added result, than to add phases each one would
require two filters, no?

: It's time invariant if the coefficients don't change over time. 
: Symmetrical coefficients will mean that it's phase linear, which is 
: something else.

I understand. Sorry for my approximative lexicon.

Ciao,
 AB

... Andrea Baldoni, 2002: messaggio non protetto da copyright.
johns@3db-labs.com wrote:

: The OP says the filter length is 8 taps = 1 msec. The bit period is
: 0.833 msec. The filter length should match the bit period for a true
: matched filter, so I'd hesitate to use that term.

I changed the sampling frequency to 9600Hz, so now I have exactly 8 taps.
I haven't noted any improvement, but I think I'll implement the hardware
with 9600 anyway. It would be easier to generate clocks, better for ADC
antialias filter and I have a not so limited CPU to become a problem.

How's the best way to simulate noise in the channel? There's some software
able to postprocess a file representing a signal to add noise?

Ciao,
 AB

... Andrea Baldoni, 2002: messaggio non protetto da copyright.