代做UESTC 4004 Digital Communications Lab 1: Modulation/Demodulation代做Matlab编程

Digital Communications

(UESTC 4004)

Lab 1: Modulation/Demodulation

This lab introduces you to the phase shift keying modulation technique. You shall transmit a signal using binary phase shift keying (BPSK) and then demodulate the received signal using BPSK demodulation. Bit Error Rate (BER) of BPSK will be calculated and plotted. Finally, the process is repeated for quadrature phase-shift keying (QPSK).

BINARY PHASE SHIFT KEYING (BPSK)

1.1 Source

This component generates 10000 information-bearing uncoded bits, which are randomly drawn from the binary set {0, 1} with the equal probability. 

Use the MATLAB code below to generate the bits.

num_bits = 10000;    % Number of bits in a frame

bits = rand(1, num_bits) > 0.5; % Generated information bits

1.2 Modulator

This component maps binary bits to BPSK symbols. The uncoded bits are fed into a BPSK modulator to yield BPSK symbols.

Use the MATLAB code below to generate the BPSK modulated bits. 

bpsk_sig = -2*(bits-0.5);   % Modulated data

1.3 Thermal Noise.

This component adds complex Gaussian noise onto the communication signal. The noise is random and should have zero mean, unity power and should vary symbol-by-symbol. Assume Signal-to-Noise Ratio (SNR) of 0 dB.

Use the MATLAB code below to obtain the received BPSK signal with noise added. 

SNR_dB = 0;    % let SNR be 0 dB

N0 = 1/10^(SNR_dB/10);  % Noise power with signal power of 1.   

a = length(bpsk_sig);

Noise = sqrt(N0/2)*(randn(1,a)+1i*randn(1,a)); % AWGN Noise

Rx_bpsk_sig = bpsk_sig + Noise;    % Received signal 

Please not the multiplying factor sqrt(N0/2) in the Noise equation is used to generate normalised noise values with amplitude sqrt(N0). Sqrt is used to convert power to amplitude. Remember the relationship between power and amplitude.

Task 1.1: Plot the first 10 bits of the received binary data using the MATLAB code below.         [1]

stem(Rx_bpsk_sig(1:10));

1.4 Demodulation.

This component first reproduces original symbols from distorted signals through employment of the minimum-distance detection algorithm.

Use the MATLAB code below to demodulate the signal.

Demod_bpsk_bits = Rx_bpsk_sig < 0;  % Demodulated BPSK signal

1.5 Bit Error Rate (BER)

This component calculates the BER by comparing the demodulated signal with the original bits produced by Source. The definition of BER is,

Use the MATLAB code below to calculate the BER.

Error_bits_bpsk = bits - Demod_bpsk_bits; % Find errors bits

BER_bpsk = sum(abs(Error_bits_bpsk))/num_bits;  % BER

Task 1.2. Write down the number of error bits. Does it remain the same when you run the code multiple times? If not, why?  [1]

1.6 BER vs SNR

Write a MATLAB code to calculate the BER for SNR values [0: 2: 10] dB.

Hint 1: You should use the components from Section 1.1-1.5 to loop through the SNR values [0: 2: 10] dB and calculate BER for each SNR value.

Hint 2: Note that you have obtained the BER of BPSK for signal-to-noise (SNR) of 0 dB by following the steps in Section 1.1-1.5.

Hint 3: You should use the “for loop”.

Task 1.3. Plot the BER as a function of SNR for SNR = [0 : 2 : 10] dB using the MATLAB code below. Add axes labels and title to the figure. [1] 

semilogy(SNR,BER_bpsk,'-');

Task 1.4. Search through MATLAB Help to find another way of BPSK modulation and demodulation. Write the code for BPSK modulation and demodulation using these built-in functions. [1]  

QUADRATURE PHASE SHIFT KEYING (QPSK)

2.1 Source

Generate 10000 information bits as in Section 1.1.

2.2 Modulator

This component maps binary bits to QPSK symbols. The generated bits are fed into a QPSK modulator to yield QPSK symbols.

Use the MATLAB code below to modulate the bits.

% Split the bits into two streams

Bits1 = bits(1:2:end);

Bits2 = bits(2:2:end);        

% QPSK pi/4 radians constellation

qpsk_sig = ((Bits1==0).*(Bits2==0)*(exp(1i*pi/4))+(Bits1==0).*(Bits2==1)...

*(exp(3*1i*pi/4))+(Bits1==1).*(Bits2==1)*(exp(5*1i*pi/4))...

+(Bits1==1).*(Bits2==0)*(exp(7*1i*pi/4)));

Task 2.1. Plot the modulated data constellation using the MATLAB code below. [1] 

plot(real(qpsk_sig),imag(qpsk_sig),'o');

2.3 Thermal Noise.

This component adds complex Gaussian noise onto the communication signal. The noise is random and should have zero mean, unity power and should vary symbol-by-symbol. Assume SNR of 0 dB.

Use the MATLAB code below to obtain the received QPSK signal with noise added.

SNR_dB = 0;     % let SNR be 0 dB

N0 = 1/10^(SNR_dB/10);  % Noise variance with signal power of 1.

a = length(qpsk_sig);

Noise = sqrt(N0/2)*(randn(1,a)+i*randn(1,a)); % AWGN Noise 

Rx_qpsk_sig = qpsk_sig + Noise;    % Received signal

Task 2.2. Plot the received data constellation using the MATLAB code below and repeat for SNR values of 10dB and 20dB. [1]

plot(real(Rx_qpsk_sig(1:100)),imag(Rx_qpsk_sig(1:100)),'*');     

What difference do you observe with the change in SNR? Explain the reason for the difference. [1]  

2.4 Demodulation.

This component first reproduces original symbols from distorted signals through employment of the minimum-distance detection algorithm. 

Use the MATLAB code below to demodulate the signal.

Bits4 = (real(Rx_qpsk_sig)<0);

Bits3 = (imag(Rx_qpsk_sig)<0);   

Demod_qpsk_bits = zeros(1,2*length(Rx_qpsk_sig));

% Demodulated bits

Demod_qpsk_bits(1:2:end) = Bits3;

Demod_qpsk_bits(2:2:end) = Bits4;

2.5 Bit Error Rate (BER)

This component calculates the BER by comparing the demodulated signal with the original bits produced by Source. The definition of BER is,

Use the MATLAB code below to calculate the BER 

Error_bits_qpsk = bits - Demod_qpsk_bits; % Calculate Bit Errors

BER_qpsk = sum(abs(Error_bits_qpsk))/num_bits;  % BER

2.6 BER vs SNR

Write a MATLAB code to calculate the BER for SNR values [0: 2: 10] dB.

Hint 1: You should use the components from Section 2.1-2.5 to loop through the SNR values [0: 2: 10] dB and calculate BER for each SNR value.

Hint 2: Note that you have obtained the BER of QPSK for signal-to-noise (SNR) of 0 dB by following the steps in Section 2.1-2.5.

Hint 3: You should use the “for loop”.

Task 2.3. Plot the BER as a function of SNR for SNR = [0:2:10] dB using the “semiology” function below. Add axes labels and title to the figure. [1]    

semilogy(SNR,BER_qpsk,'--');

Task 2.4. Compare the BER vs SNR curves for BPSK and QPSK by plotting them on the same graph. What modulation scheme would you prefer if you wanted to have reduced error rates? What disadvantage will you face with your selection, if any. [2]

 

 

 

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图