communication system project
1 ECE 401, University of Dayton, Spring 2019
ECE401: Communication Systems Project 2
PCM BandPass simulation (BPSK, BFSK and BASK modulation and demodulation)
1. Background: PCM
Figure 1: PCM BaseBand Transmitter and Channel block diagram
A MATLAB script file (ECE401_Proj2_PCM_student.m) that simulates the transmitter depicted in Figure 1 has been provided to you. It generates random binary data and performs line coding using a polar non-return to zero (NRZ) scheme. The script file plots the polar NRZ narrow pulse data ak(t) waveform (0.2sec worth) and its spectrum. Additionally, it also shows how to implement a transmission filter using a rect() pulse for g(t) so as to generate a Flat Top Polar NRZ PAM signal s(t). Further, it provides a plot of s(t) and the values of s(t) at the occurrence of the deltas (at the key samples) in the line code by making use of circular markers in the time domain. Finally, it also computes the spectrum of s(t). The simulation bit rate is equal to 80 bits/sec and hence as it can be seen in figure 2 the BaseBand BandWidth of s(t) is equal to 80Hz (range that the main lobe of the weighting sinc function occupies). Start by examining the various key parameters used in the provided MATLAB code (bit rate [bit_rate], bit duration [bit_interval], number of samples used for a bit duration [num_samples_bit], sampling frequency [sample_rate], etc.).
Figure 2: PCM NRZ Polar using rect() pulses and its spectrum
t (seconds)
0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5
s( t)
(V ol
ts )
-2
-1
0
1
2 Polar NRZ PCM
Polar NRZ waveform
key samples
frequency in Hz
-150 -100 -50 0 50 100 150
M ag
ni tu
de
0
0.5
1
Spectrum of PCM polar
2 ECE 401, University of Dayton, Spring 2019
2. PCM BandPass simulation (BPSK, BFSK and BASK modulation and
demodulation)
a. BPSK: Binary Phase Shift Keying.
i. Simulate the BPSK system shown in Figure 3. Let s(t) be a Flat Top Polar NRZ PAM signal from part (1). Use a carrier frequency that is equal to 500 Hz. Within the same figure window provide: 1) a plot of SBPSK(t) in a subplot() superimposed along s(t) and its values at key samples using circular markers and 2) the spectrum of SBPSK(t) in another subplot(). You may make use of the provided function compute_fft() to compute its spectrum (see provided code). We will be comparing the various modulated and demodulated signals with s(t) along its key sample values throughout this project (to understand the outcomes after each module and how they represent the original signal). We will also make use of subplots() in the same figure window. One subplot for the original and resultant waveforms and another subplot for the frequency response of the resultant waveform.
Figure 3: BPSK modulation block diagram
ii. Design a Band Pass Filter that is centered at 500Hz using fdatool().
Make sure to specify the sampling frequency Fs in fdatool() to be equal to the sample_rate of your simulation. Let the BandWidth be equal to the essential BandPass channel BW requirement. Export and save the impulse response h(t) as BPSK_channel.matI (so that you can easily load it and not have to go through the design process using fdatool [just like project 1] when you rerun your code). Plot the impulse response against time (Hint: use sample_period to specify the temporal gap between samples of impulse response from fdatool() and ensure it is centered about zero) and the frequency response of H(f).
iii. Pass SBSPK(t) through the channel that you designed just like the examples found in folder “ISI eye pattern and raised cosine” available in Appendix A. Using subplots, provide a plot of the resultant waveform x(t), s(t) along its values at key samples and the spectrum of X(f).
3 ECE 401, University of Dayton, Spring 2019
Figure 4: BPSK coherent demodulation
iv. Implement the coherent demodulation scheme depicted in Figure 4. Save its impulse response as LPF.mat. Show results for the intermediate signal (after the LPF). These should include the waveforms in the time domain along with the values at key samples of s(t) and the spectrum of the intermediate signal (after the LPF) in another subplot. I have provided the expected results before the LPF but you are not required to generate those results.
v. Apply a threshold to get the demodulated bit wave �̃�𝑠(𝑡𝑡).Use a threshold that is equal to 0 (since polar) to generate �̃�𝑠(𝑡𝑡). Compare s(t) against �̃�𝑠(𝑡𝑡) (i.e., superimpose the two in the same figure window).
vi. Compute the mean square error between the original Polar NRZ PCM at key samples and demodulated signal at key samples (for the entire duration of the waveforms [10 secs]). Without noise, since we are making use of essential bandpass BW, there shouldn’t be any error. Note that even if we were to make use of the minimum bandpass BW required (the so called Nyquist BW [BW = Rp=Rb since binary] where we only take into account part the main lobe), we still won’t have any error at key samples. Of course, we will have some ISI but the eye pattern will be open).
vii. Now to make things interesting let simulate noise within channel. For
this, using the MATLAB built in function wgn(), generate a white Gaussian noise that is the same length as x(t) and is of power 10 dBw (do help on wgn()) and add it to s(t) right after passing through the channel and examine the mean square error just like part v. You can just copy and paste relevant lines of code and modify it accordingly. In form of comments within script file, comment on the performance.
b. BFSK: Binary Frequency Shift Keying
i. Implement the block diagram described in Figure 5. Use fc = 500Hz and a frequency sensitivity = 150Hz/Volts. Use the following m-code to generate your BFSK signal:
4 ECE 401, University of Dayton, Spring 2019
delta_t= t(2)-t(1); integral_m=cumsum(s_rect)*delta_t; Kf=150; fc = 500; s_BFSK=cos(2*pi*fc*t + 2*pi*Kf*integral_m);
Show plots of SBFSK(t), s(t) and its values at key samples and SBFSK(f).
Figure 5: BFSK modulation block diagram
ii. Design a BandPass channel centered at 500Hz. Design a BPF with BW of ~460Hz to allow for both BFSK signals to pass through the channel. Describe the parameters used for your BPF within the script file, to include the BW, upper and cut-off frequencies of the BandPass channel. Export and save its impulse response as BFSK_channel.mat. Plot hBFSK_channel(t) and HBFSK_channel(f) via subplots.
iii. Simulate transmission by processing sBFSK(t) using the BPF that you just created. Plot the relevant results. See provided expected results available in Appendix B.
iv. Implement the non-coherent BFSK demodulation block diagram sown in Figure 6. Save the impulse responses of the BPFs. For the envelope detectors use the following function and parameters colfilt(“signal in question”, [1,31],'sliding', @max). Don’t forget to take out the Mean of the envelopes before comparing against each other (before comparator). Provide plots of relevant results (impulse and frequency responses of the two BPFs, the two intermediate waveforms that you get after the BPFs, waveforms obtained after the envelope detectors and finally the output of the comparator). All of those must be superimposed with s(t) and its key values. Again see my results that I have in Appendix B.
v. Calculate error just like you did for the BPSK case and comment on
performance. Error should be calculated for the entire duration of the waveforms at key samples only.
vi. Now add white Gaussian noise just like you for BPSK of power 10dBW
(same power as BPSK) and add it to the signal right after passing it through the BandPass channel and examine the total mean squared error after demodulation.
5 ECE 401, University of Dayton, Spring 2019
Note that Part b of this project this is Lab 7. Hence you should expect to see similar results (similar time domain waveforms as the ones that you saw during the lab sessions)
Figure 6: Non-coherent BFSK demodulation
c. BASK: Binary Amplitude Shift Keying.
Make the original NRZ Polar signal an On-Off signal. Repeat the steps of part (a) to modulate and to pass the signal through the same BandPass Channel. Implement the demodulation scheme shown in Figure 7 to demodulate the transmitted signal. For the envelope detector use colfilt(“signal in question”, [1,31],'sliding', @max). Again make sure to subtract the mean before thresholding. Also, since on-off an adequate T would be 0.5Volts. Calculate the error for two different cases: Without and with noise of 10 decibel watts.
Figure 7: Non-Coherent BASK demodulation
Note that BASF has a strong DC component and hence you may need to adjust the y-axis like I did when plotting the various spectras
3. Preparation and submission of Project.
Three .m files for part(a), part(b) and part(c) of Part 2. ALL .mat files that contain the impulse response of the various filters (i.e., you need to supply all files pertaining to your programs such that they run without error). Provide answers to the questions in form of comments within the script files. Based on the Mean square errors that you have calculated, which one out of three schemes performed best through a noisy channel? Rank them accordingly to their performance and try to justify your answer (Hint: we briefly discussed this in
6 ECE 401, University of Dayton, Spring 2019
class at least for on-off vs polar case, try to refer to that discussion). Please email the final report and associated ‘m-files’ to browningj2@udayton.edu
7 ECE 401, University of Dayton, Spring 2019
Appendix for Part A
8 ECE 401, University of Dayton, Spring 2019
9 ECE 401, University of Dayton, Spring 2019
10 ECE 401, University of Dayton, Spring 2019
11 ECE 401, University of Dayton, Spring 2019
Appendix B
12 ECE 401, University of Dayton, Spring 2019
13 ECE 401, University of Dayton, Spring 2019
14 ECE 401, University of Dayton, Spring 2019
15 ECE 401, University of Dayton, Spring 2019
16 ECE 401, University of Dayton, Spring 2019
17 ECE 401, University of Dayton, Spring 2019
18 ECE 401, University of Dayton, Spring 2019
Appendix C
19 ECE 401, University of Dayton, Spring 2019
20 ECE 401, University of Dayton, Spring 2019
21 ECE 401, University of Dayton, Spring 2019