users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN...

15
Department of Electrical and Computer Engineering ELEC 6141- Wireless Communications Submitted to: Dr. Yousef Shayan Submitted by: Neema Satishkumar – 27244827 Md Sami Refayet- 27668600 Salaheddine Jebari-27514654 Date Submitted: 12/08/2016 1 | Page

Transcript of users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN...

Page 1: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

Department of Electrical and Computer Engineering

ELEC 6141- Wireless Communications

Submitted to: Dr. Yousef Shayan

Submitted by: Neema Satishkumar – 27244827

Md Sami Refayet- 27668600

Salaheddine Jebari-27514654

Date Submitted: 12/08/2016

1. ABSTRACT.

1 | P a g e

Page 2: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

In this project we are simulating QPSK modulation scheme and an AWGN channel using MATLAB and then we compare their theoretical and simulated bit error rates using the graph. We further apply BCH codes to the above system and then compare the results. In the third part of the project we simulate an un-coded system assuming we have a Doppler Spread due to mobile movement in the channel. We further simulate and draw the bit error rate of the system for maximum mobile speed 60 Km/Hour considering flat fading. We discuss the results after applying the codes to the above simulated system. The project also involves the designing of block interleaver in order to improve the performance of the above communication system.

2. INTRODUCTION

i. Quadrature Phase Shift Keying:

In Quadrature Phase Shift Keying (QPSK) two sinusoids, sine and cosine, are used as modulation functions. The sine cosine signals are varied or modified in terms of phase with respect to the message symbol and thus the modulation is achieved. In QPSK scheme one symbol contains 2 bits. The following equation outlines QPSK modulation technique.

si(t)=2Est√cos(2πfct+(2n−1)π4),n=1,2,3,4

si(t)=2EsTcos(2πfct+(2n−1)π4),n=1,2,3,4

The constellation diagram of QPSK uses four points, equally spaced around a circle. With four phases, QPSK can encode two bits per symbol, shown in the diagram with gray coding to minimize the bit error rate (BER)

Figure-1: Constellation diagram for QPSK with Gray coding.

A QPSK modulator is implemented using a serial to parallel converter which is used to separate odd and even bits from the generated information bits. Each of the odd bits (quadrature arm) and even bits (in-phase arm) are converted to NRZ formatting a parallel manner. The signal on the in-phase arm is multiplied by cosine component and the signal on the quadrature arm is multiplied by sine

component. QPSK modulated signal is obtained by adding both in-phase and quadrature arm signals.

Fig-2: Transmitter of a QPSK system

A coherent demodulator is used in QPSK demodulator. By using PLL(phase lock loop) at the receiver we can make the carrier frequency and phase known to the receiver which explains the coherent detection. A PLL essentially locks to the incoming carrier frequency and tracks the variations in frequency and phase. In the demodulator the received signal is multiplied by a reference frequency generators (cos(ωt)) and (sin(ωt)) on separate arms (in-phase and quadrature arms). The multiplied output on each arm is integrated over one bit period using an integrator. A threshold detector makes a decision on each integrated bit based on a threshold. Finally the bits on the in-phase arm (even bits) and on the quadrature arm (odd bits) are remapped to form detected information stream. In phase arm has the detector and the quadrature arm used a sin (ωt) function.

Fig3: Receiver side of QPSK system

ii. BER:

QPSK can be characterized by a quaternary modulation but it actually carries two independently modulated quadrature carriers. With this interpretation, the even (or odd) bits are used to modulate the in-phase component of the carrier, while the odd (or even) bits are used to modulate the quadrature-phase component of the carrier.

Pb= Q√(2Eb/N0)

For QPSK modulation the channel can be modeled as, y=ax+n

2 | P a g e

Page 3: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

Where y is the received signal at the input of the QPSK receiver, x is the complex modulated signal transmitted through the channel,”a” is a channel amplitude scaling factor for the transmitted signal usually 1. ‘n’ is the Additive Gaussian White Noise random variable with zero mean and variance σ². For AWGN the noise variance in terms of noise power spectral density N0 is given by,

σ²=N0/2

iii. BCH Codes:

This class of codes is a remarkable generalization of the Hamming code for multiple-error correction. For any positive integers m ≥ 3 and t < 2m−1, there exists a binary BCH code with the following parameters:

Block length: n = 2m − 1

Number of parity-check digits: n − k ≤ mt Minimum distance: dmin ≥ 2t + 1.

We call this code a t-error-correcting BCH code.

iv. Doppler Spread and Coherence Time:Delay spread and coherence bandwidth are parameters which describe the time dispersive nature of the channel in a local area. However, they do not offer information about the time varying nature of the channel caused by either relative motion between the mobile and base station, or by movement of objects in the channel. Doppler spread and coherence time are parameters which describe the time varying nature of the channel in a small-scale region. Doppler spread is a measure of the spectral broadening caused by the time rate of change of the mobile radio channel and is defined as the range of frequencies over which the received Doppler spectrum is essentially non-zero. When a pure sinusoidal tone of frequency

fc is transmitted, the received signal spectrum, called the Doppler spectrum, will have components in the range  fc – fd  to fc + fd, where fd  is the Doppler shift. The amount of spectral broadening depends on fd which is a function of the relative velocity of the mobile, and the angle θ between the direction of motion of the mobile and direction of arrival of the scattered waves. If his baseband signal bandwidth is much greater than BD  the effects of Doppler spread are negligible at the receiver. This is a slow fading channel. Coherence time Tc is the time domain dual of Doppler spread and is used to characterize

The time varying nature of the frequency depressiveness of the channel in the time domain. The Doppler spread and coherence time are inversely proportional to one another. That is,

Tc ≈ 1/ fm

Coherence time is actually a statistical measure of the time duration over which the channel impulse response is essentially invariant, and quantifies the similarity of the channel response at different times. In other words,

coherence time is the time duration over which two received signals have a strong potential for amplitude correlation. If the reciprocal bandwidth of the baseband signal is greater than the coherence time of the channel, then the channel will change during the transmission of the baseband message, thus causing distortion at the receiver. If the coherence time is defined as the time over which the time correlation function is above 0.5, then the coherence time is approximately.

Tc = 9/16Πfm

iv.i. Fading:

A wireless communication channel, the transmitted signal can travel from transmitter to receiver over multiple reflective paths. This gives rise to multipath fading which causes fluctuations in amplitude, phase and angle of arrival of the received signal. For example, the transmitted signal from the BS (base station) may suffer multiple reflections from the buildings nearby, before reaching the mobile station.

Such multipath fading channels are often classified into slow fading/fast fading and frequency-selective/flat fading channels.

Fig4: Multiple fading iv.ii. Interleaver and deinterleaver:

Interleavers and Deinterleavers are designed and used in the context of characteristics of the errors that might occur when the message bits are transmitted through a noisy channel. To understand the functions of an interleaver/deinterleaver, understanding of error characteristics is essential. Two types are errors concern communication system design engineer. They are burst error and random error.

Below there is a block diagram of the interlever- deinterleaver process which is followed by a process diagram of a random block interleaver.

3 | P a g e

Page 4: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

Fig5: Interleaving and De-interleaving

iv.iii. Block Interleavers

A block interleaver accepts a set of symbols and rearranges them, without repeating or omitting any of the symbols in the set. The number of symbols in each set is fixed for a given interleaver. The interleaver's operation on a set of symbols is independent of its operation on all other sets of symbols.

Fig6: Random Interleaver process

*I’ll write one small paragraph here*

3. SIMULATION RESULTS:

Figure-7: comparison of Theoretical and simulated value of BER VS Eb/N0.

a) Graph here explains the comparison between theoretical and practical values. Theoretical and practical BERs being 10-1

Figure-8: comparison of Theoretical and simulated value of BER VS Eb/N0 with BCH coding.

b) In this case, we have a (15, 11) single error correction code. Comparison shows the difference between theoretical and simulation results.

Figure-9: comparison of Theoretical and simulated value

of BER VS Eb/N0,uncoded QPSK with Rayleigh Fading.

4 | P a g e

0 1 2 3 4 5 6 7 8 9 10Eb/N0

10-5

10-4

10-3

10-2

10-1

100

BE

R

BER Vs Eb/N0 , BCH coded QPSK

TheorySimulation

0 5 10 15Eb/N0 (dB)

10-5

10-4

10-3

10-2

10-1

100

BE

R

BER Vs Eb/N0 (QPSK)

TheoreticalSimulation

Page 5: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

c)

Since we have a Doppler Spread due to mobile movement in the channel this time we observe more flat curves

*ONE GRAPH IS MISSING HERE*

Figure-11: comparison of BER VS Eb/N0, BCH coded QPSK system with Interleaver under fading.

e) Here, the system is using an Interleaver under fading. The coding is there this time. We come up with some significant improvement.

f. Discussion of the results:

Part a: As we can see from the two graphs, the simulated result is typical to the theoretical one, and we get a really good performance (BER = 10-5) when EB/N0 is close to 10 dB.

Part b: In this part, after adding the BCH coding we can notice that we improved the performance of the system as designed in Part A.We can see that to reach BER=10-

5 you need only EB/N0 = 8.2 dB where as it was 10 dB in the previous part.

Part c: In this section of the project we added the effect of Rayleigh’s fading (without coding), and we see that the performance drops significantly compared to previous sections (Eb/N0= 25 dB gives BER=10-3)

Part d: This section explains that BCH coding is not the perfect solution to improve our system’s performance because of flat fading. The result is almost as less significant as without BCH coding.

Part f: By comparing the graphs we have, we can see that addition of the interleaver improved the system’s performance significantly .Hence we can conclude that this is one of the best solution to achieve better BER.

*LETS WRITE THE CONCLUSION TOMORROW AFTER WE MEET*

5 | P a g e

5 10 15 20 25Eb/N0 (dB)

10-5

10-4

10-3

10-2

10-1

100

BE

R

BER Vs Eb/N0 ( uncoded QPSK with Rayleigh Fading

TheorySimulation

0 5 10 15 20 2510

-5

10-4

10-3

10-2

10-1

100

Eb/N0

BE

R

BER Vs Eb/N0 curve for BCH coded QPSK system with Interleaver under fading

BER of BCH coded QPSK systemBER Using an Interleaver

Page 6: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

APPENDIXQuestion A

clear all;ticN=10^6; % No of bitsEbN0=0:15; % Eb/N0 values in dBE=1; Normilized bit error % ----- calculating Probability of error for Different values of Eb/No%==================================for i=1:length(EbN0) snr=10^(EbN0(i)/10);% conversion from dB to linear sgma=sqrt(E/(2*snr))% Standard diviation of the noise er = 0 % a counter for the error %---------------------------------------------------------------------- % Generation of bits bits=round(rand(1,N)); D_I=bits(1:2:end); % Inphase components D_Q=bits(2:2:end); % Quadrature Components % Modulation of Data D_I_map=D_I*(-2)+1; D_Q_map=D_Q*(-2)+1; % Signal to be transmitted signal_TX=D_I_map+sqrt(-1)*D_Q_map; % generation of White Gaussian noise with variance N0/2 noise=sgma*(randn(1,N/2)+sqrt(-1)*randn(1,N/2)); % the received signal under the effect of AWGN channel signal_Rx= signal_TX+noise; %Detection process for the signal Rx_d_I=real(signal_Rx)<=0; Rx_d_Q=imag(signal_Rx)<=0; % Estimation of the data data_estimation=vertcat(Rx_d_I, Rx_d_Q); Bits_estimation=reshape(data_estimation,1,N); % the comparaison between the transmitted data and the recovered data er=sum(xor(Bits_estimation,bits));

% Counting the total number of bit errors by adding bit difference in each estimated symbol

BER_theory(i)=(1/2)*erfc(sqrt(snr)); % Calculation of Theoretical Bit Error Rate BER_estimated(i)=er/N; % Calculation of Estimated Bit Error Rateend %--------------------------------------------------------%--- Plotting Part%-------------------------------------- %BER vs EBN0 semilogy(EbN0,BER_theory,'b*-','LineWidth',2); hold on semilogy(EbN0,BER_estimated,'ro--','LineWidth',2);grid on;axis([0 max(EbN0) 10^-5 1]); % Defining the Axis Rangelegend('Theoretical', 'Simulation');xlabel('Eb/N0 (dB)');ylabel('BER');title('BER Vs Eb/N0 (QPSK)');toc

Question B

clear all;ticN=99000; % bitsEbN0=0:10; % Eb/N0 E=1; % forming the gerator matrix, parity matrix and syndrom table parity_mat=[1 1 1 1;0 1 1 1;1 0 1 1;1 1 0 1;1 1 1 0;0 0 1 1; 0 1 0 1;0 1 1 0;1 0 1 0; 1 0 0 1;1 1 0 0]; % Parity Matrixgenerator_mat=[parity_mat,eye(11)]; % Generator MatrixH_inverse=[eye(4),parity_mat']; % Parity Check Matrixerror=vertcat(zeros(1,15),eye(15)); % Error TableSyndrom=error*H_inverse'; % Syndrome Table===================================% Probability of error for Different values of Eb/Nofor k=1:length(EbN0) SNR=10^(EbN0(k)/10); % Eb/N0(dB) to linear value standar_dev =sqrt((E/(2*SNR))*(15/11)); % Standard Deviation of Noise bit_error=0; % counting errors DATA=round(rand(1,N)); Data Generation word=reshape(DATA,11,N/11).';% Conversion of Data vector to 11 bit messages Code_Word=reshape(mod(word*generator_mat,2).',1,(N*15/11)); % Generation of Code Word in_Code=Code_Word(1:2:end); % Inphase Components of Code Word

6 | P a g e

Page 7: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

Q_code=Code_Word(2:2:end); % Quadrature Components of Code Word %------------------------------------------------------------------------- % Modulation of Code Word code_wordI_mod=in_Code*(-2)+1; code_wordQ_mod=Q_code*(-2)+1; %------------------------------------------------------------------------ % Transmitted Signal Tx_word=code_wordI_mod+sqrt(-1)*code_wordQ_mod; % AWGN noise AWGN_N=standar_dev*(randn(1,length(Code_Word)/2)+sqrt(-1)*randn(1,length(Code_Word)/2)); % Received Signal Through AWGN channel Rx_word=Tx_word+AWGN_N; %Detection Rx_data_I=real(Rx_word)<=0; Rx_data_Q=imag(Rx_word)<=0; %Estimation of Code Word data_estimated=vertcat(Rx_data_I,Rx_data_Q); estimate_code_word=reshape(data_estimated,15,length(Code_Word)/15).'; % Syndrome Decoding s=mod(estimate_code_word*H_inverse',2); % Error Detection and Correction for row=1:length(Code_Word)/15 for counter=1:16 if s(row,:)==Syndrom(counter,:) corrected_word(row,:)=xor(estimate_code_word(row,:),error(counter,:)); end end end % Conversion of Code Word to Message Vector corrected_msg=corrected_word(:,5:15); corrected_vector=reshape(corrected_msg',1,N); % Calculation of Simulated Bit Error Rate bit_error=sum(xor(corrected_vector,DATA)); estimated_ber(k)=bit_error/(N); % Calculation of Theoretical Bit Error Rate pr_code=(1/2)*erfc(sqrt(SNR*(11/15))); funct=0; for i=2:15 funct=i*nchoosek(15,i)*pr_code^i*(1-pr_code)^(15-i)+funct; theoretical_ber(k)=(1/15)*funct;

end end % BER Vs Eb/N0 curveclose allsemilogy(EbN0,theoretical_ber,'bs-','LineWidth',2);hold onsemilogy(EbN0,estimated_ber,'ko--','LineWidth',2);grid on;axis([0 max(EbN0) 10^-5 1]); legend('Theory', 'Simulation');xlabel('Eb/N0 ');ylabel('BER');title('BER Vs Eb/N0 , BCH coded QPSK');toc

Question C

clear all;ticN=1034; EbN0=1:25; E=1; ===================================% Probability of error for Different values of Eb/Nofor k=1:length(EbN0) SNR=10.^(EbN0(k)/10); % Eb/N0(dB) to linear value standard_dev=sqrt(E/(2*SNR)); % Standard Deviation of Noise error_bit=0; % error counter bits=0; % Bit counter while error_bit<1e4 DATA=round(rand(1,N)); % data generation in_data=DATA(1:2:end); %Inphase components Q_data=DATA(2:2:end); %Quadrature components

7 | P a g e

Page 8: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

% Modulation of the data data_I_mod=in_data*(-2)+1; data_Q_mod=Q_data*(-2)+1; % Transmition of the Signal signal_Tx=data_I_mod+sqrt(-1)*data_Q_mod; % AWGN noise Noise=standard_dev*(randn(1,517)+sqrt(-1)*randn(1,517)); % Fading Coefficient T=sqrt(0.5)*randn+ sqrt(0.5)*sqrt(-1)*randn; %the received signal under the effect of the fading and the AWGN signal_RX= signal_Tx.*T+Noise; divide_T=signal_RX./T; % Detection process in_received=real(divide_T)<=0; Q_received=imag(divide_T)<=0; % Estimation of Data rx_sig= vertcat(in_received,Q_received); rx_msg=reshape(rx_sig,1,1034); error_bit=sum(xor(DATA,rx_msg))+error_bit; % Error Detection by comparing Estimated Data with the Transmitted Data bits=bits+N; %Incrementing the bit counter by number of bits end BER_theory(k)=1/2*(1-sqrt(SNR/(1+SNR))); % theoritical bit error BER_estimated(k)=error_bit/bits; % Estimated Bit Error Rateend

% BER Vs Eb/N0 curveclose allsemilogy(EbN0,BER_theory,'bx-','LineWidth',2);hold onsemilogy(EbN0,BER_estimated,'ko--','LineWidth',2);grid on;axis([1 max(EbN0) 10^-5 1]); % Defining the Axis Rangelegend('Theory', 'Simulation');xlabel('Eb/N0 (dB)');ylabel('BER');

title('BER Vs Eb/N0 ( uncoded QPSK with Rayleigh Fading');toc%===================================

Question D

clear all;ticN=1034; EbN0=1:40; E=1 parity_mat=[1 1 1 1;0 1 1 1;1 0 1 1;1 1 0 1;1 1 1 0;0 0 1 1; 0 1 0 1;0 1 1 0;1 0 1 0; 1 0 0 1;1 1 0 0]; % Parity MatrixGenerator_mat=[parity_mat,eye(11)]; % Generator Matrixinverse_parity=[eye(4),parity_mat']; % Parity Check Matrixerror=vertcat(zeros(1,15),eye(15)); % Error Pattern TableSyndrom=error*inverse_parity'; % Syndrome Table

% Probability of error for Different values of Eb/Nofor k=1:length(EbN0) SNR=10^(EbN0(k)/10); % Eb/N0(dB) to linear value Standard_dev=sqrt((E/(2*SNR))*(15/11)); % Standard Deviation of Noise bit_error=0; % Error counter bits=0; % Bit counter while bit_error<15000 DATA=round(rand(1,N)); % Data Generation WORD=reshape(DATA,11,N/11).'; % Conversion to 11 bit messages CODE_WORD=reshape(mod(WORD*Generator_mat,2).',1,(N*15/11)); % Generation of Code Word IN_code_word=CODE_WORD(1:2:end); Q_code_word=CODE_WORD(2:2:end); % Modulation of Code Word code_wordI_map=IN_code_word*(-2)+1; code_wordQ_map= Q_code_word*(-2)+1;

8 | P a g e

Page 9: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

% Transmitted Signal Tx_word=code_wordI_map+sqrt(-1)*code_wordQ_map; % Fading Coefficient Fading_COEF=sqrt(0.5)*(randn+sqrt(-1)*randn); % AWGN noise NOISE=Standard_dev*(randn(1,705)+sqrt(-1)*randn(1,705)); % Received Signal Through AWGN channel Rx_word=Fading_COEF.*Tx_word+NOISE; % Dividing Received Signal by Fading Coefficient divide_fading=Rx_word./Fading_COEF; %Detection process Rx_data_I=real(divide_fading)<=0; Rx_data_Q=imag(divide_fading)<=0; %Estimated Code Word DATA_estimated=vertcat(Rx_data_I,Rx_data_Q); Code_Word_estimated=reshape(DATA_estimated,15,length(CODE_WORD)/15).'; % Syndrome Decoding s=mod(Code_Word_estimated*inverse_parity',2); % Error Detection and Correction for row=1:length(CODE_WORD)/15 for counter=1:16

if s(row,:)==Syndrom(counter,:) corrected_word(row,:)=xor(Code_Word_estimated(row,:),error(counter,:)); end end end % Conversion of Code Word to Message Vector message_corrected=corrected_word(:,5:15);

corrected_msg_vector=reshape(message_corrected',1,N); bit_error=sum(xor(corrected_msg_vector,DATA))+bit_error; % Calculation of No of Errors bits=bits+N; end BER_estimated(k)=bit_error/bits; % Calculation of Estimated Bit Error Rate BER_calculated(k)= 1/2*(1-sqrt((SNR*11/15)/(1+SNR*11/15)));% Calculation of Theoretical Bit Error Rateend

% BER Vs Eb/N0 curve close allsemilogy(EbN0,BER_calculated,'bx-','LineWidth',2);hold onsemilogy(EbN0,BER_estimated,'ko--','LineWidth',2);grid on;axis([1 max(EbN0) 10^-5 1]); % Defining the Axis Rangelegend('Theory', 'Simulation');xlabel('Eb/N0 ');ylabel('BER');title('BER Vs Eb/N0 curve for QPSK coded with fading');toc

Question E

clear all;ticN=2326500; EbN0_dB=0:25; E=1; parmat=[1 1 1 1;0 1 1 1;1 0 1 1;1 1 0 1;1 1 1 0;0 0 1 1; 0 1 0 1;0 1 1 0;1 0 1 0; 1 0 0 1;1 1 0 0]; % Parity MatrixGenmat=[parmat,eye(11)]; % Generator MatrixH=[eye(4),parmat']; % Parity Check Matrixerr=vertcat(zeros(1,15),eye(15)); % Error Pattern TableS=err*H'; % Syndrome Table

9 | P a g e

Page 10: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

% Loop for calculating Probability of error for Different values of Eb/Nofor z=1:length(EbN0_dB) snr=10^(EbN0_dB(z)/10); % Conversion of Eb/N0(dB) to linear value sgma=sqrt((E/(2*snr))*(15/11)); % Standard Deviation of Noise bit_error=0; % Initializing Error counter bits=0; % Initializing Bit counter x=1; y=1410*11; bits_gen=round(rand(1,N)); % Data Generation for i=1:N/(1410*11) data=bits_gen(x:y); word=reshape(data,11,1410).'; % Conversion of Data vector to 11 bit messages code_word=mod(word*Genmat,2); % Generation of Code Word code_wordI=code_word(1:2:end,:); % Inphase Components of Code Word code_wordQ=code_word(2:2:end,:); % Quadrature Components of Code Word % Modulation of Code Word code_wordI_map=code_wordI*(-2)+1; code_wordQ_map=code_wordQ*(-2)+1; % Transmitted Signal Tx_code_word=code_wordI_map+sqrt(-1)*code_wordQ_map; % Generation of Fading Coefficients h=sqrt(0.5)*(randn(1,15)+sqrt(-1)*randn(1,15)); % Generation of AWGN noise noise=sgma*(randn(705,15)+sqrt(-1)*randn(705,15)); % Loop for Multiplying Fading Coefficients to Each bits in column for a=1:15 rayleigh_sig(:,a)=h(a).*Tx_code_word(:,a); end % Received Signal Through AWGN channel Rx_code_word=rayleigh_sig+noise; % loop for Dividing each column by respective fading coefficient for a=1:15 divide_h(:,a)=Rx_code_word(:,a)./h(a); end

%Detection Rx_data_I=real(divide_h)<=0; Rx_data_Q=imag(divide_h)<=0; Rx_data_I_msg=reshape(Rx_data_I,1,705*15); Rx_data_Q_msg=reshape(Rx_data_Q,1,705*15); %Estimated Code Word Estimated_data=vertcat(Rx_data_I_msg,Rx_data_Q_msg); Estimate_data=reshape(Estimated_data,1410,15); % Syndrome Decoding s=mod(Estimate_data*H',2); % Error Detection and Correction for row=1:1410 for counter=1:16 if s(row,:)==S(counter,:) corrected_word(row,:)=xor(Estimate_data(row,:),err(counter,:)); end end end % Conversion of Code Word to Message Vector corrected_msg=corrected_word(:,5:15); corrected_msg_vector=reshape(corrected_msg',1,1410*11); bit_error=sum(xor(corrected_msg_vector,data))+bit_error; % Calculation of No. of Errors x=x+1410; y=y+1410; end % Calculation of Estimated Bit Error Rate using an interleaver estimated_ber(z)=bit_error/N; % Calculation of Theoretical Bit Error Rate for BCH coded under Rayleigh Fading theoretical_ber(z)=1/(4*snr*11/15); end% Plotting Bit Error Probability Vs Eb/N0 curveclose allsemilogy(EbN0_dB,theoretical_ber,'bs-','LineWidth',2);

10 | P a g e

Page 11: users.encs.concordia.causers.encs.concordia.ca/home/m/m_refaye/ELEC6141-Pr…  · Web viewFor AWGN the noise variance in terms of noise power spectral ... then the channel will change

hold onsemilogy(EbN0_dB,estimated_ber,'rx--','LineWidth',2);grid on;axis([0 max(EbN0_dB) 10^-5 1]); % Defining the Axis Rangelegend('BER of BCH coded QPSK system', 'BER Using an Interleaver');xlabel('Eb/N0 (dB)');ylabel('Bit Error Probability (Pb)');title('Bit Error Probability (Pb) Vs Eb/N0 curve for BCH coded QPSK system with Interleaver under fading');toc

11 | P a g e