Lab 5 Primer#
The range of complexity for a pulse amplitude modulation (PAM) transceiver system can vary drastically. A working version that demonstrates the core principles can be simulated with just a few lines of code. In practice, many additional subsystems need to be added for reliable operation.
Simulation#
In simulation, pulse amplitude modulation is relatively straightforward, and can be achieved with just a handful steps.
Mapping data to pulses#
The first step in any digital communication system is serialization, the process of converting a useful data structure into a stream of bits. For example, the following MATLAB code serializes the ascii string “meatball” into an array of 56 bits.
>> serialized_data = reshape((dec2bin(uint8('meatball'))'),[1,56])
serialized_data =
'11011011100101110000111101001100010110000111011001101100'
In 2-PAM, we map a bit of ‘0’ to a pulse with an amplitude
upsampled_data = upsample(str2num(serialized_data')*2-1,16);
pulse_shaping_filter = rcosdesign(0.8,4,16,'normal');
sequence_of_pulses = conv(upsampled_data,pulse_shaping_filter,'same')
figure; plot(sequence_of_pulses); hold on; stem(upsampled_data.*max(pulse_shaping_filter));
Polyphase filter bank for pulse shaping#
Recall that we upsampled the data by a factor of
The diagram above depicts the polyphase structure to implement an 8-tap FIR filter with impulse response
Modulation#
The signal above is what we call the baseband signal. Before transmitting, we want shift the spectrum to higher frequencies in a way that can be reversed at the transmitter. A simple method is with sinusoidal modulation and demodulation
f0 = 12000; fs = 48000; w0 = 2*pi*f0/fs; n = 1:length(sequence_of_pulses);
modulated = sequence_of_pulses.' .* cos(w0*n);
figure; plot(sequence_of_pulses); hold on; plot(modulated);
Demodulation#
Demodulation can be achieved by once again multiplying by the carrier. The second multiplication by cosine introduces frequency components at
demodulated = modulated .* cos(w0*n);
recovered_pulses = conv(demodulated,pulse_shaping_filter,'same');
figure; plot(sequence_of_pulses); hold on; plot(recovered_pulses);
Mapping pulses to data#
We end up with a signal that can be downsampled and quantized to recover the original data.
>> recovered_data = downsample(recovered_pulses,16) > 0
recovered_data =
'11011011100101110000111101001100010110000111011001101100'
Receiver#
The receiver is where most of complexities occur. In the simulation above, we assumed that the receiver’s carrier exactly matches the transmitter (both in frequency and phase). We assumed that the signal traveled from transmitter to receiver with no distortion or time delay. We also assumed that the transmitter and receiver have exactly the same sampling rates so that every symbol was separated by exactly 16 samples. Though these assumptions are rarely true in practice, each type of error can be addressed by adding an appropriate subsystem.
Costas loop for carrier recovery#
The Costas loop is one way to track the phase
where
For an in-depth discussion of the Costas loop, see Software Receiver Design by C. Richard Johnson, Jr., William A. Sethares and Andrew Klein, section 10.4.
Symbol Clock Recovery#
The carrier recovery process will correct a frequency offset so that the signal can be properly demodulated.
The demodulated signal is downsampled and quantized to produce a stream of bits at the receiver. This process is sensitive to any timing offset. For example, the red and black stem plots show two possible ways that the demodulated signal might be downsampled. In one case (red), the values are recovered exactly. In the other case (black) many of the samples are close to zero and might easily be overwhelmed by noise.
A symbol clock recovery subsystem should adapt the sampling times to minimize errors.
Symbol Clock Recovery#
One simple clock recovery method consists of two bandpass filters and a squaring block.
The first bandpass filter passes any oscillations that occur at a rate
Error probability#
It is common to model each sample of noise an independent draw from Gaussian distribution with variance
As the noise variance increases, it is more likely that a symbol is incorrectly decoded. However, as the symbol spacing
As a result, the bit error probability will depend on the ratio
Power maximization for timing recovery#
For an in-depth discussion of timing recovery via output power maximization, see Software Receiver Design by C. Richard Johnson, Jr., William A. Sethares and Andrew Klein, section 12.4.