EE512 V6: Two bit Binary  Phase Shift Keying with BandPass Channel and Additive White Gaussian Noise :

advertisement
EE512V6:TwobitBinaryPhaseShift
KeyingwithBandPassChanneland
AdditiveWhiteGaussianNoise:
ModulationandDemodulation
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. 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.mat
clear all;
% INSERT GROUP NAME AND NUMBER OF BITS
groupname='baseline'
Nbit=3*16384
% END OF INSERT
Nseq=2 % Number of bit streams
filename=sprintf('%s_Bsize.mat',groupname)
save(filename); % stores groupname, Nbit, Nseq in baseline_Bsize.mat
% load filename.mat to retreive
1
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.mat
clear all;
groupname='baseline' % instructor enters this name to select student project
filename=sprintf('%s_Bsize.mat',groupname);
load (filename) % retrieve matrix size
filename
Nbit
Nseq
B=rand(Nseq,Nbit);
B=binarize(B);
size(B)
filename=sprintf('%s_B.mat',groupname);
save(filename);
% save the active groupname
save '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
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
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
Figure 4.1: 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.2: Spectrum of channel.
The output spectrum of the filtered signal is shown in Fig. 4.3.
Figure 4.3: Spectrum of Signal after being filtered by the channel.
A sample section of the input signal is shown in Fig. 4.4.
5
Figure 4.4: 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.5: 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.6: Sample of signal coming out of the channel after being filtered and corrupted by additive noise.
6
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.1: Input signal to the demodulator.
Figure 5.2: Quadrature demodulator.
The output of the quadrature demodulator for the first few bits is shown in Fig. 5.3.
7
Figure 5.3: 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.4: Signal space mapping of entire PSK signal after demodulation.
8
6. Bitcheck.mDetectionandAnalysis
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.1: 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.2: 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
Figure 6.3: 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 = ee51213V6
filename =ee51213V6_Bsize.mat
Nbitsingle = 32768
NbitALL = 65536
Nseqnow = 2
N = 1048576
NALL = 2097152
ans = OK: bitcheck matrices consistant
nbsent = 65536
nbreceived = 65536
miss = 0
false = 0
Nerror = 0
mu1 = 0.7655
mu0 = 0.2344
STD1 =
STD0 =
0.0508
0.0504
10
SQRT of SNR1 =
SQRT of SNR0 =
Discriminate =
15.0652
4.6542
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.
J 01 
1   0
 12   02
11
Download