Ones and zeros cannot fly. A carrier carries them.
Ten minutes of reading. Move the sliders, then the two scripts of the lab will read like plain sentences.
Shift keying
Digital data is a string of 1s and 0s, but an antenna or a cable can only carry a wave. Shift keying is digital modulation: one property of a sine carrier is switched between two values, one for a 1 and one for a 0. Change the amplitude and it is ASK, change the frequency and it is FSK, change the phase and it is PSK. Each bit lasts one bit time Tb (1 s in the lab scripts), so the bit rate is 1/Tb.
ASK, FSK and PSK
In the lab scripts the ASK signal is a product: the carrier times a message that is all ones for a 1 and all zeros for a 0, which is what a balanced modulator does with a unipolar data stream. The FSK script builds two products, carrier 1 times the message and carrier 2 times the inverted message, and adds them, so exactly one carrier is present in each bit.
The correlator receiver
The ASK script demodulates with a correlator: it multiplies each received bit by the carrier and adds the samples. For a 1 the product is c², which is never negative, so the sum is large (about 100 for 101 samples). For a 0 the bit is all zeros and the sum is 0. A decision device then compares x with a threshold: the script uses x > 0. A hardware receiver does the same job by rectifying the signal, low pass filtering it and squaring it up with a comparator. For FSK a receiver correlates each bit with both carriers and chooses the larger result.
Noise
The lab scripts have no noise, so the bits always come back right. Add noise and the correlator output of a 0 is no longer exactly 0. With the threshold at 0, half of the zeros are then read as ones. A threshold half way between the two levels (about 50) is far better. ASK is sensitive to noise because a 0 is just no signal, and a fading channel can make a 1 look like a 0.
In the virtual lab
Both scripts call rng(seed) before rand, so the same bits come back on every run and a figure can be compared. Seed default gives the same bits as MATLAB after rng('default'). In guided mode each step ticks itself when it is really done; you can also tick a step yourself with its number box.
What you should see
| File | Settings | Result |
|---|---|---|
| ask.m | seed default, N = 10, fc = 10 Hz | bits 1 1 0 1 1 0 0 1 1 1; ten carrier cycles in each 1; the demodulated bits are the same |
| fsk.m | seed default, N = 8, 2 Hz and 5 Hz | bits 1 1 0 1 1 0 0 1; two cycles in each 1, five cycles in each 0 |
Check yourself
Q1What is shift keying?
Shift keying is digital modulation: one property of a sine carrier (amplitude, frequency or phase) is switched between fixed values according to the data bits, so each bit is sent as a short burst of carrier.
Q2Which kinds of shift keying are there?
Amplitude shift keying (ASK, also called on-off keying), frequency shift keying (FSK), phase shift keying (PSK, for example BPSK and QPSK), and their combination quadrature amplitude modulation (QAM). Variants include MSK and GFSK.
Q3How does ASK send a bit?
ASK changes the amplitude of the carrier with the data. In its simplest form (on-off keying) the carrier is sent for a 1 and nothing is sent for a 0: s(t) = b(t)·A cos 2πfc t with b(t) equal to 0 or 1.
Q4How does FSK send a bit?
FSK sends one carrier frequency for a 1 and another for a 0, with a constant amplitude. With the default values of the lab script a 1 is sent at 2 Hz and a 0 at 5 Hz.
Q5Explain the principle of an ASK transmitter and receiver.
The unipolar data stream (0 V or 5 V) is multiplied by the carrier in a balanced modulator. A 1 multiplies the carrier by a positive constant and passes it unchanged; a 0 multiplies it by 0 and gives no output. The receiver rectifies, filters and squares up the signal, or, as in the lab script, correlates each bit with the carrier and compares the result with a threshold.
Q6How does PSK differ from ASK and FSK?
PSK keeps the amplitude and frequency and changes the phase of the carrier: in binary PSK the phase is 0 for a 1 and 180° for a 0, so the carrier simply changes sign. It needs a coherent receiver but has the best noise performance of the three when all are detected coherently.
Q7Which steps does an ASK script need?
Make a carrier c = sqrt(2/Tb)*sin(2*pi*fc*t) over one bit and a set of random bits from rand(1,N) > 0.5. Multiply the carrier by each bit to get the ASK wave. To demodulate, correlate each received bit with the carrier (sum of the product) and decide with corr > 0. Finally plot the bits, the message, the carrier, the ASK wave and the demodulated bits with subplot, plot and stem.
Q8Which steps does an FSK script need?
Make two carriers, one for each bit value, over one bit, and a set of random bits. For each bit take carrier 1 when the bit is 1 and carrier 2 when it is 0, which can be written as c1.*m + c2.*(1 - m). Then plot the bits, the message, both carriers and the FSK wave.