Binary Phase-Shift Keying Modulation and Demodulation_SOLUTION
Files necessary to complete this assignment: noneDeliverables Due: Before your assigned lab session before Dec. 19th Introduction Modulation is an important component of communication systems. Modulation is the process of converting a baseband, low-frequency signal into a signal with high frequency components so that we can transfer information across a physical communication channel. We user modulation to transmit data over air, across outer-space, through wires, and in ﬁber optics. There are many types of modulation schemes. Each have a variety of advantages and disadvantages. In this lab, we ﬁll focus on a digital communications scheme known as phase-shift keying (PSK) modulation. This is a standard scheme for wireless LAN IEEE 802.11 communications systems1. Binary phase-shift keying (BPSK) is the simplest type of phase-shift keying modulation. To implement BPSK, we assume the message (the baseband signal) is binary, i.e., it contains only 1 or −1 values. A information bit at time t controls, or modulates, the phase of the carrier cos(ωc). If the bit is 1, we transmit cos(ωc + 0). If the information bit is −1, we transmit cos(ωc + π). In this lab, we will simulate a binary phase-shift keying receiver system in MATLAB. In Part 1 and Part 2 of the lab, we will explore and simulate modulation/demodulation of the BPSK signal when our communication channel is ideal. In Part 3 of the lab, we will then study the eﬀects of channel noise and other errors at the receiver. This lab assignment has three learning objectives: 1. Understand the binary phase-shift keying modulation and demodulation process 2. Simulate binary phase-shift keying modulation / demodulation in MATLAB 3. Explore the eﬀects of realistic errors on binary phase-shift keying systems Deliverables This lab assignment has two deliverables: 1. One (1) lab report (see the “Lab Report Guidelines” on how to write it) 2. One (1) demonstration of your working BPSK simulation to the lab instructor Please submit a hard or electronic copy of deliverables to your lab instructor before Dec. 19th. 1Sanjeev Kumar, ”BER Improvement of Wireless LAN IEEE 802.11 Standard Using Wavelet Packet Transforms,” Journal of Communication Technology, vol. 3, no. 3, 2012. Part 1: Design a BPSK transceiver BPSK Modulation: We begin with deriving BPSK signals as well as the modulation and demodulation process. We represent a sequence bits (each with value -1 or +1) as a discrete signal b[n] such that b is the ﬁrst bit transmitted, b is the second bit transmitted, etc. We can convert these bits into a continuous-time representation by holding the value for a period of T seconds. Therefore, our continuous-time, baseband signal can be represented by e b(t) = b , 0 ≤ t < T b , T ≤ t < 2T . . . b[N] , (N −1)T ≤ t < NT This represents the continuous-time message that we want to transmit. From this information, we can deﬁne the BPSK modulated signal x(t) as x(t) =e b(t)cos(ωct + φ) , (2) where ωc and φ represent the frequency and phase of the carrier, respectively. If φ = 0, the signal will have a phase of 0 whene b(t) = 1 and a phase of π whene b(t) = −1. To help understand how BPSK works, assume the Fourier transform ofe b(t) is e B(ω) with a bandwidth ωB (i.e., has non-zero values for ωB ≤ ω ≤ ωB). Determine the Fourier transform of x(t). BPSK Demodulation: Now we discuss the demodulation process. In practice, a receiver will not have perfect knowledge of a carrier’s frequency or phase. In this lab, we will assume that both the carrier frequency and phase are known. Although, in the last part of the lab, we will explore how errors in these assumed frequency and phase aﬀect our results. When the frequency and phase are known, the demodulation process on x(t) is as follows: 1. Multiply x(t) with cos(ωct + φ) such that x1(t) = x(t)cos(ωct + φ) 2. Apply a low-pass ﬁlter h(t) to x1(t) to remove the higher frequency interference. The result, b b(t) = x1(t)∗h(t), is an estimate ofe b(t). 3. Sampleb b(t) with a period of T to obtain an estimate of our message b[n]. Include in Lab Report “Analytical Methods” Section: Answer: Why is it necessary to hold each binary value for some period of time T? Include: Your derivation of the Fourier transform of x(t). Discuss: How / why does BPSK modulation work? Discuss: How / why does BPSK demodulation work? Answer: Why do we need to sampleb b(t)? Part 2: Simulate a BPSK system in MATLAB Generate a bit sequence / message: For testing purposes, we will consider a random discrete sequence of bits with values of +1 or -1. This sequence represents some arbitrary message that we want to transmit with BPSK. To generate these bits, ﬁrst use the MATLAB command c = randn(25,1); to generate a vector with 25 randomly chosen values ranging from −∞ to ∞. The random numbers are taken form a normal (or Gaussian) distribution. Now develop a command or set of commands that will convert the vector c into vector b such that b[n] =( 1 ; c[n] ≥ 0 −1 ; c[n] < 0 . In the above expression, b[n] represents the value in vector b at index n and c[n] represents the value in vector c at index n. The resulting vector b should only contain +1 values and −1 values. Modulate your bit sequence: Although we have been discussing continuous-time modulation, we will simulate the system in discrete-time with MATLAB. For this simulation, assume 1. A bit duration of T = 0.001 s 2. A carrier frequency of fc = 100,000 Hz 3. A carrier phase of φ = 0 radians 4. A sampling frequency of fs = 106 samples/s (sampling period of Ts = 10−6 s/sample) Use these values to determine the number of samples per bit and total number of samples of your transmitted signals. Now develop a MATLAB function function [x, btilde] = BPSK(b,fc,phi,T,Ts) that generates the sampled values of the modulated signal x(t) given the sequence of bits b, the carrier frequency fc, the phase of the carrier phi, the bit duration T, and the sampling period Ts. The BPSK function has two outputs: x and btilde. The vector x represents the modulated, transmitted signal x(t). The vector btilde represents the continuous-time sequence of bits ine b(t). Use the pwelch command in MATLAB to estimate the spectrum of btilde and x to make sure that you the modulation behaves as you derived in Part 1. Demodulate your transmitted signal: In the previous subsection, we modulated our binary message. Now we will demodulate it. Write a MATLAB function function bhat = DBPSK(x,fc,phi,T,Ts) that processes the modulated BPSK signal x to recreate (or estimate) the baseband signale b(t). You will need to design the lowpass ﬁlter to complete the demodulation. To design this ﬁlter, use the MATLAB function h = fir1(N,Wn) . This command designs an N-th order lowpass ﬁlter h(t) with a cutoﬀ frequency of Wn. Note that in MATLAB, a frequency of Wn = 1 corresponds to half the sampling frequency. Therefore, the parameter Wn should be selected with this oddity in mind. The number of coeﬃcients N (i.e., the length of the ﬁlter’s impulse response signal) will determine how steeply the magnitude response of the ﬁlter goes down in the stop band. Since we have not studied discrete-time ﬁlters, you should determine the parameter N by trial and error. Use the command freqz(h,1,1024,1/Ts) to plot the magnitude and phase response of the ﬁlter your design. Once the ﬁlter is designed, use bhat = conv(x1,h,’same’) to generate bhat from x1. The vectors x1 and bhat represent x1(t) andb b(t), respectively, from Part 1. Again, use pwelch to make sure that bhat is as theory predicted. Estimate your message by sampling: Now implement a program in MATLAB that samples bhat with a period of T and estimate the value of each bit based on the sign of that sample. That is, if the sign is positive, the bit has a value of +1. If the sign is negative, the bit has a value of -1. Once you have made sure the transmitter and receiver are working as expected, you are ready to explore imperfections that are unavoidable in the real world. Include in Lab Report “Experimental Design” Section: Explain: What what type of signal(s)/data do you need to complete this simulation (analysis)? Explain: How did you generate your data? Include in Lab Report “Results and Discussion” Section: Include: One or two plots comparing btilde and bhat Answer: Are there diﬀerences between the plots of btilde and bhat? Why or why not? Answer: What did you choose for your ﬁlter parameters (order and cutoﬀ frequency)? Why did you choose these? Part 3: Study realistic conditions Channel noise: In real life, we transmit data across noisy channels or environments. We often model the noise as additive white Gaussian noise. This is a common model for background noise in electronics. An additive white Gaussian noise corrupted signal x(t) can be expressed as xr(t) = x(t) + η(t). (3) In MATLAB we can simulate the above with the command xr = x + sigma*randn(L,1) where L contains the number of samples in xr and x. The constant sigma is the standard deviation of the noise. Note that you may need to use randn(L,1) or randn(1,L) depending on whether xr and x are column vectors or row vectors, respectively. Develop a MATLAB program that repeats the modulation and demodulation process from Part 2, but with a few diﬀerences. Now use 100 bits and perform demodulation with the noisy received signal as described above. Vary sigma from 0 to 10 in steps of 0.1. For each value of sigma, compute the communication system’s bit error rate (BER), deﬁned by BER = Number of bits incorrectly estimated Total number of bits . Plot the bit error rate (BER) as a function of sigma, the standard deviation. Carrier frequency error: Repeat the above analysis for when the carrier frequency fc of the demodulator (DBPSK) is diﬀerent from the carrier frequency of the modulator (BPSK). Vary this diﬀerence from 0 Hz to 50 Hz in increments of 0.5 Hz. Plot the resulting bit error rate (BER) as a function of frequency diﬀerence. Phase error: Repeat the above analysis for when the carrier phase phi of the demodulator (DBPSK) is diﬀerent from the carrier phase of the modulator (BPSK). Vary this diﬀerence from 0 radians to π radians in increments of π/100 radians. Plot the resulting bit error rate (BER) as a function of phase diﬀerence. Include in Lab Report “Experimental Design” Section: Explain: What what type of signal(s)/data do you need to complete this simulation (analysis)? Explain: How did you generate your data? Is this diﬀerent from Part 2? How or how not? Explain: How did you modify your data to introduce each type of error? Include in Lab Report “Analytical Methods” Section: Answer: How did you compute the bit error rate? Include in Lab Report “Results and Discussion” Section: Answer: In a practical system, why might we encounter noise? Answer: In a practical system, why might we encounter frequency error? Answer: In a practical system, why might we encounter phase error? Include: Your plot of the bit error rate (BER) versus noise standard deviation Answer: Why does the BER change with noise standard deviation as shown in the plot? Include: Your plot of the bit error rate (BER) versus carrier frequency error Answer: Why does the BER change with carrier frequency as shown in the plot? Include: Your plot of the bit error rate (BER) versus carrier phase error Answer: Why does the BER change with carrier phase as shown in the plot?
You'll get 1 file (778.4KB)