# Resources for modulation/demodulation techniques with example code

So I remember seeing someone recommending a DSP book that had actual code for modulation and demodulation of a communication signal. Does anyone have any recommended resources they could point me towards that might having this? I've seem lots of things that have block diagrams, but no actual implementation of how it's done. I'm interested in learning how to sync and demodulate Binary DPSK, QPSK, and chirm modulation (or sweep modulation like they use for radar and sonar I believe)

For example, I know for Binary DPSK I can use differential encoding, by taking a sample in time, and multiplying it by another sample in time from 1 bit ago. Let's say my bitrate is $R$, then my time per bit is $T_b = \frac{1}{R}$, and my received signal is $x[n]$, and my sample rate is $F_s$. I can get a signal $y[n]$ such that

$$y[n] = x[n]\cdot x[n-T_s F_s]$$

and I can probably decode everything from there, but it might be easier to sync if I used a decode signal, $d[n]$ such that

$$d[n] = d[n-1] + y[n]-y[n-T_s F_s]$$

Then $d[n]$ can be used to synchronize and to determine if the bit was a 1 or 0. I'm not some of the terms and variables I'm using aren't correct, and this might not be the best way to do it, but it's the only way I know how, would I would like to learn other methods of doing this, either in the time or frequency domains, to see if another method might fit one application better than another.

• It sounds like the topic you're hinting at is "timing recovery." Synchronization is where a lot of the hard work in communication systems is spent. Timing recovery is part of that, and depending on the modulation scheme that you're using, you might need carrier frequency and/or phase recovery as well. – Jason R Feb 21 '17 at 20:20
• I would be good learning more about timing recovery, but its really just all of it. The only reason I've seen actual code for binary DPSK is because that's something we do at work. the synchronization method we use seems to work well, but it would still be good to know what techniques are commonly used, both for synchronization and and demodulation, along with actual code or algorithms commonly used for such cases. – gerrgheiser Feb 21 '17 at 20:48
• Well, Proakis, Sklar, Kammeyer... The usual suspects of EE digital comms textbooks – Marcus Müller Feb 21 '17 at 21:18
• "Telecommunications Breakdown" by Johnson and Sethares has a lot of code. The first edition is available for free at the authors' website, just google the title. – MBaz Feb 21 '17 at 22:46
• I like this book: amazon.com/MATLAB-Simulink-Digital-Communication-Yang/dp/… which has actual and practical coded algorithms for a wide range of different waveforms, including mod and demod, carrier recovery, timing recovery, etc – Dan Boschen Feb 22 '17 at 3:58