Lab 2

In this lab, we are going to explore how noise affects the detection accuracy of a digital signal using binary andgeneral Quadrature Amplitude Modulation (QAM) format. The entire process is illustrated in the followingdiagram.

1. Generate a vector v that contains 100000 random bits of 1 or -1. Set v = 2*randi([0 1],1,100000)-1;

2. Generate the digital waveform s: Let the bit period be 50 ps i.e. 20 Gbits/s and NRZpulse shapeis used. Let there be 10 samples/bit in this simulation i.e. the samples are spaced 5 ps apart andsis 10 times longer than v. Each bit in v is multiplied to 10 samples in s. 3. Add Gaussian noise to s using the function:

y = s+sigma_noise*randn(size(s));

To calculate the correct noise variance Var_noise = (sigma_noise)

2

for a given SNR(indB), perform the following steps:

1) Calculate the signal power by

Ps = mean(s.^2);

2) Since Ps/Var_noise = SNR (in linear units), we can calculate Var_noise for a givenSNR (in dB) by

Var_noise = Ps/(10^(SNR(in dB)/10))

Start with SNR= 5dB. 4. Get the middle 5

th sample of each bit (an example is shown below where the red samples are themiddle 5

th sample of each bit) and make a bit decision from that sample.

Count the number of detection errors. Calculate the BER by

BER = number of detection errors/total number of bits

5. Repeat steps 3 and 4 with SNR = 7, 9, 11, 13, 15, 17. 6. Plot the SNR-BER plot. use the function semilogy( )to plot the curve.

7. Now, consider passing s into a channel that is characterized as an ideal low-pass filter withbandwidth 13, 10 or 9 GHz (you can refer back to Matlab Hw 2 on how to pass a signal into anideal low-pass filter) as shown below. Let the channel output be u so that the noisy receivedsignal is

y = u+sigma_noise*randn(size(u));

For each filter bandwidth, repeat step 3 to 6 and plot the BER vs SNR curve on the same graph. You should get a figure similar to the one shown below.

8. Repeat steps 1 to 6 (no need to repeat step 7) with polar NRZ 4-PAM signals. In this case, youhave to calculate the values of the 4 levels so that the average power of v is 1. When calculatingthe BER, you can assume the BER = Symbol error ratio(SER)/2. semilogy( )creates a plot using a base 10 logarithmic scale for the y-axis and a linear scale for the x-axis. Asample figure is shown below.

Questions to answer and submit:

1) How does the BER generally change with SNR? Explain this trend. 2) Is 100000 bits enough to simulate the BER when SNR = 15 or 17 dB? Explain why or why not. 3) How does the BER changes with bandwidth of the low-pass filter in step 7? Explain this trend. 4) What are the detection threshold values for the PAM-4 signals in step 8?

5) In our simulations the lowest SNR = 5 dB. What will the BER become if the SNR become even smaller?

版权所有：留学生编程辅导网 2021,All Rights Reserved 联系方式：QQ:99515681 电子信箱：99515681@qq.com

免责声明：本站部分内容从网络整理而来，只供参考！如有版权问题可联系本站删除。