13
EE512 V6: Two bit Binary Phase Shift Keying with BandPass Channel and Additive White Gaussian Noise : Modulation and Demodulation by Laurence G. Hassebrook 4-1-2013 We simulate Two Bit Binary Phase Shift Keying (BPSK) with amplitude modulation and mixer based demodulation. The modulated signal is synthesized by using two independent upsampled random bipolar bit streams, one stream modulates a cosine carrier wave and the other modulates a sine wave carrier. The combined result is sent through a bandpass channel and corrupted by Additive White Gaussian Noise (AWGN). Assuming no phase error, the modulated signal is demodulated using a cosine (in-phase) and sine wave (quadrature) mixer configuration. Because the binary signals are bipolar, the resulting modulation is equivalent to phase modulation by /8, /4+/8, /2+/8 and 3/4+8. Both input and output signals are analyzed for bandwidth and noise distribution. The goal is to run the baseline system and tweek the number of bits to a maximum number without causing any bit errors. The students are then required choose their own “alias”to send the instructor alias_createBsize.m, alias_modulator.m and aleas_demodulator.m. NO WRITEUP is required. The instructor will run their code and if they do not get any errors, will accept it and post the results using their alias. 1

FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

EE512 V6: Two bit Binary Phase Shift Keying with BandPass Channel and Additive White Gaussian Noise : Modulation and Demodulation

by Laurence G. Hassebrook4-1-2013

We simulate Two Bit Binary Phase Shift Keying (BPSK) with amplitude modulation and mixer based demodulation. The modulated signal is synthesized by using two independent upsampled random bipolar bit streams, one stream modulates a cosine carrier wave and the other modulates a sine wave carrier. The combined result is sent through a bandpass channel and corrupted by Additive White Gaussian Noise (AWGN). Assuming no phase error, the modulated signal is demodulated using a cosine (in-phase) and sine wave (quadrature) mixer configuration. Because the binary signals are bipolar, the resulting modulation is equivalent to phase modulation by /8, /4+/8, /2+/8 and 3/4+8. Both input and output signals are analyzed for bandwidth and noise distribution. The goal is to run the baseline system and tweek the number of bits to a maximum number without causing any bit errors. The students are then required choose their own “alias”to send the instructor alias_createBsize.m, alias_modulator.m and aleas_demodulator.m. NO WRITEUP is required. The instructor will run their code and if they do not get any errors, will accept it and post the results using their alias.

1. Baseline_createBsize.m

The student must insert their alias in place of “baseline” and choose the value of Nbit that they want to use.

% generate groupname_Bsize.matclear all;% INSERT GROUP NAME AND NUMBER OF BITSgroupname='baseline'Nbit=3*16384% END OF INSERTNseq=2 % Number of bit streamsfilename=sprintf('%s_Bsize.mat',groupname)save(filename); % stores groupname, Nbit, Nseq in baseline_Bsize.mat% load filename.mat to retreive

1

Page 2: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

2. Bgen2013V6.m

The instructor “owns” Bgen…m. He must change the “baseline” name in his version to the alias of the student. Bgen generates a random bit matrix that has Nseq rows and Nbit columns.

% generate bit matrix based on groupname_Bsize.matclear all;groupname='baseline' % instructor enters this name to select student projectfilename=sprintf('%s_Bsize.mat',groupname);load (filename) % retrieve matrix sizefilenameNbitNseqB=rand(Nseq,Nbit);B=binarize(B);size(B)filename=sprintf('%s_B.mat',groupname);save(filename);% save the active groupnamesave 'activegroup' groupname;

3. Baseline_modulator.m

The student must change the “baseline” name at the beginning and end of Baseline_modulator.m to be their alias in order to make this program their own. The modulator does two things, (1) upsample the bit streams to pseudo-continuous time and (2) modulate the cosine and sine wave carriers by the bipolar representation of the bit streams. Fig. 3.1 shows sample sections from the two bit streams after upsampling to pseudo-continuous time.

Figure 3.1: Samples of first few bits from input sequences.

The spectra of the two bit sequences are shown in Fig. 3.2. Notice how wide band they are but most of the information is contained in the mainlobe.

2

Page 3: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

Figure 3.2: Spectra of input sequences.

The modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and +1 for bipolar signals. Then the first signal is multiplied by a cosine wave and the second is multiplied by a sine wave. The mathematical representation of this approach is:

s ( t )=(2 b1 (t )−1 ) cos (2 πf c t )+(2 b2 (t )−1 ) sin (2πf c t ) (3.1)

An alternative approach would be to phase modulate the angle of a single modulator waveform. The resulting waveform is shown for a sample section in Fig. 3.3. Notice the amplitude is constant. Using Eq. (3.1), can you show the amplitude is constant?

Figure 3.3: Sample from 2 bit modulated quadrature signal.

The resulting modulated signal spectrum is shown in Fig. 3.4.

3

Page 4: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

Figure 3.4: Spectrum of modulated quadrature PSK signal.

The modulator is allowed to generate a “bitcheck” signal to be used later by the bitcheck.m program for determining errors from the demodulated signal. This data is stored in aliasname_Bcheck.mat file. The demodulator is not allowed to access this file. The bit check values 1 and -1 are used to tell the bitcheck.m program to test the demodulated signal at those locations for a “1” or “0”, respectively.

Figure 3.5: Sample section of bitcheck signals overlayed with the bit signals.

4. Channel2013V6.m

The instructor “owns” Channel…m. The channel first filters the modulated signal and then adds Gaussian noise to it. The input signal spectrum is shown in Fig. 4.1.

4

Page 5: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

Figure 4.6: Modulated signal in log scale.

The first operation that the channel does is filter the input signal. In this case, the channel is a bandpass system represented by the spectrum shown in Fig. 4.2.

Figure 4.7: Spectrum of channel.

The output spectrum of the filtered signal is shown in Fig. 4.3.

Figure 4.8: Spectrum of Signal after being filtered by the channel.

A sample section of the input signal is shown in Fig. 4.4.

5

Page 6: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

Figure 4.9: Sample of signal before entering the channel.

The same sample section as shown in Fig. 4.4 is passed through the channel filter and shown in Fig. 4.5. Notice the boundaries where there was a drastic change in value are now suppressed. These are the some of the transition boundaries.

Figure 4.10: Sample of signal after being filtered by the channel.

The filtered signal is evaluated for range and based on the range, a fractional amount of Gaussian noise is added to the signal. The same sample section with the added noise is shown in Fig. 4.6

Figure 4.11: Sample of signal coming out of the channel after being filtered and corrupted by additive noise.

6

Page 7: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

5. Baseline_demodulator.m

The demodulator uses two “legs” where one is the in-phase leg and the second is the quadrature leg. The in-phase result is obtained by mixing with a cosine and the quadrature is determined by mixing with a sine wave. The input signal is shown in Fig. 5.1 and the demodulator is shown in Fig. 5.2.

Figure 5.12: Input signal to the demodulator.

Figure 5.13: Quadrature demodulator.

The output of the quadrature demodulator for the first few bits is shown in Fig. 5.3.

7

Page 8: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

Figure 5.14: Separated and demodulated bit signals.

Using the in-phase response signal as “x” and the quadrature as “y” a signal space distribution map can be formed as shown in Fig. 5.4.

Figure 5.15: Signal space mapping of entire PSK signal after demodulation.

8

Page 9: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

6. Bitcheck.m Detection and Analysis

The bitcheck.m program takes in the demodulated and possibly decoded signals from the demodulator. Bitcheck.m also has access to the bitcheck signal for evaluating the bit error performance. Fig. 6.1 shows a sample section from the input signal superimposed with the bitcheck signal. The threshold of the signal is 0.5 so if a bitcheck value is +1 then the input signal should be a “1” and have a value above 0.5 to be correct. And when the bitcheck value is -1, then the input signal should be below 0.5 indicating a “0” is present.

Figure 6.16: Sample section overlayed bitcheck with input signal.

The data and bitcheck information comes to Bitcheck.m in matrix form where each row is a different bit sequence in pseudo-continuous time. For simplicity, bitcheck.m converts the matrices to vectors or a single sequence by lexicographical conversion as shown in Fig. 6.2.

Figure 6.17: Graphical representation of lexicographical conversion.

The distributions in Fig. 6.3 contain the histogram data from both sequences combined. The “1” signal values and the “0” signal values have be separated at the bitcheck locations.

9

Page 10: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

Figure 6.18: Distribution of "1s" and "0s" from both bit sequences.

The text output of bitcheck.m contains important information about the performance. A sample output is below:

groupname = ee51213V6filename =ee51213V6_Bsize.matNbitsingle = 32768NbitALL = 65536Nseqnow = 2N = 1048576NALL = 2097152

ans = OK: bitcheck matrices consistant

nbsent = 65536nbreceived = 65536

miss = 0false = 0Nerror = 0

mu1 = 0.7655mu0 = 0.2344

STD1 = 0.0508STD0 = 0.0504

10

Page 11: FLAT TOP SAMPLING AND DISCRETE-TIME …€¦ · Web viewThe modulator uses an amplitude approach to the phase modulation. That is, the two bit sequences are scaled between -1 and

SQRT of SNR1 = 15.0652SQRT of SNR0 = 4.6542

Discriminate = 7.4252

The “miss” and “false” are error counts for missed “1” detection and incorrect “0” detections or false alarms. The sum of misses plus false alarms is the total number of errors Nerror.

The mean values for the detected signals of “1” and “0” are mu1 and mu0 respectively. These are found by taking the values at the bitcheck locations and averaging them together. They should correspond to the peak locations in Fig. 6.3. The standard deviations, STD1 and STD0, are calculated from the signal values at the bitcheck locations, just like the mean values are. The discriminant measure is the absolute difference in the means divided by the square root of the sum of the variances such that.

J01=|μ1−μ0|

√σ12+σ0

2

11