communication modulations

34
COVENTRY UNIVERSITY 1 COVENTRY UNIVERSITY FACULTY OF ENGINEERING & COMPUTING BACHELOR OF ENGINEERING (HONS) IN ELECTRICAL AND ELECTRONIC ENGINEERING A311SE Communications and networks COURSEWORK STUDENT NAME : M. Faazil Fairooz STUDENT ID NUMBER : 4701970 SUPERVISOR : DR. ROHAN MUNASINGHE

Upload: faazil-fairooz

Post on 30-Oct-2014

79 views

Category:

Documents


4 download

DESCRIPTION

BPSK and QAm

TRANSCRIPT

Page 1: Communication Modulations

COVENTRY UNIVERSITY

1

COVENTRY UNIVERSITYFACULTY OF ENGINEERING & COMPUTING

BACHELOR OF ENGINEERING (HONS)IN

ELECTRICAL AND ELECTRONIC ENGINEERING

A311SE Communications and networks

COURSEWORK

STUDENT NAME : M. Faazil FairoozSTUDENT ID NUMBER : 4701970SUPERVISOR : DR. ROHAN MUNASINGHE

Page 2: Communication Modulations

COVENTRY UNIVERSITY

2

TABLE OF CONTENTS:

Chapter 1: Abstract ………………..……………………………………………..…....…...……..51.1 Motivation……………………………...………………..…L………………………..........51.2 Methodologies and Result……………………………..…………….……..................…….51.3 Conclusion……………………………………………………..…………..…...................5

Chapter 2: Introduction…………………………………………………………….…..…….……6

2.1 Introduction…………………………………………………….………………...…….…...62.2 Objective………………………………………………………………......…......................6

Chapter 3: QAM Background and Principal…………………………...................................…….7

3.1 Governing Principles3.2 Brief History of Evolution

3.3 Principle of Operations of Multilevel Digital Modulations

Chapter 4: Principle of Operations of M-Qam Modulation…………...… ……………………..11

4.1 Detail of Operations……………………………………………..…….……………..…114.2 Detail of Functionality……………………………………………...………………..…114.3Waveform Illustration for Better Understanding……………….……...………................11

Chapter 5: Parameters for Performance Measurement of M-Qam Modulation……....................13

Chapter 6: Design and Software Implementation………………….…….....................................14

6.1.1 Design Calculations………………………………………………………………...146.1.2 Calculate the number of bits per symbol k………………………………..……. 146.1.3 Phase calculation of wave design …………………………………….………….156.1.4 Prepare a table for binary bits to symbols assignment…………………………. 156.1.5 Draw the constellation diagram for given 8 M_QAM modulations…….…….....166.1.6 MATLAB program………………………………………………………….....…166.1.7 Final output Modulated wave……………………………………………............186.1.7 Screenshots ………………………………………………………………....…..19

Page 3: Communication Modulations

COVENTRY UNIVERSITY

3

Chapter 7: Analysis/ conclusion on Results…………………………………………….……...20

7.1 Analysis…………………………………………………………………...…………….207.2 Conclusion………………………………………………………………...…………….20

Chapter 8: Introduction to Forward Error Correction (FEC) Coding……………………….…21

8.1 Introduction…………………………………………………………………………….21

Chapter 9: Principles for Forward Error Correction (FEC)……………………......……………22

9.1Principles of the FEC9.2Performance Measurement Parameters For (FEC) Coding

9.2.1 SNR9.2.2 Minimum Distance

Chapter 10: Principles for Hamming Coding and Decoding……………………….….……..24

10.1Hamming Coding………………………………………………………………….…...24

Chapter 11: Design and Software Implementation…………………………………………….26

Chapter 12: Analysis/ conclusion on Results………………………………………………..….32

Turnitin Report ……………………………………………………………………...………..33

Page 4: Communication Modulations

COVENTRY UNIVERSITY

4

Page 5: Communication Modulations

COVENTRY UNIVERSITY

5

ACKNOWLEDGMENTS

The writer would like to send his distinct recognitions to his lecturers Dr. Rohan Munasingha and

Mr. Duminda for their great effort during the coursework and before.

Also, I would like to thank my parents for their standing behind me.

Page 6: Communication Modulations

COVENTRY UNIVERSITY

6

CHAPTER 1: Abstract

1.1 Motivation

Over time, the globe is still improving and advancing around us, there is a lot essence and

personalities trying to change things around us in the field of communication but rather little

success is achieved in this technological stride, it’s the same in all humans they tend to live and

work with less effort and time and more efficiently and effectively

This project has been emotively dedicated to communication techniques, because we are in a fast growing

world, where it is called a global village for us to be in the streamline of that technology we have to have

very large and complex communication infrastructure is to be used where two main modulation schemes

has been used and tested in computer simulation environment for proper function.

which would be QAM (M-ary Quadrature Amplitude Modulation) and BPSK (Binary Phase Shift

Keying) modulation techniques the main objective of this project is to clearly understand and

hypothetically assess each problem given below, The first would be the understanding of QAM digital

modulation techniques and the second would be the design of a Hamming code and its error detection

mechanism.

1.2 Methodologies and Result

The methodology used firstly would be the calculating all mathematical numbers and variables

and then finally getting into matlab for computing and plotting purposes, where the accuracy of

mathematical calculated data could be tested. The second part of this report concentrates the

construction of the Hamming code using basic theory after this part has been accomplished, it

too will be fed into the computer for processing. For the above stated problem Matlab and

Simulink would be extensively used

1.3 Conclusion

Final results would that all mathematical parts would be solved and graphically represented. The

main outcome of this project would be that an in-depth knowledge is acquired when completing

this project

Page 7: Communication Modulations

COVENTRY UNIVERSITY

7

CHAPTER 2: Introduction

2.1 Introduction

Telecommunications in recent times has greatly evolved, where new and newer technologies have

come in recent years. These technologies came in two forms mainly as analog and digital

communication. As a part of our project we mainly look into digital communications. Where QAM

techniques are used is large at hand. If it is to be seen in a nut shell QAM relates to the change in

the phase of the digital signal with relationship to the input signal.

2.2 Objective

The objective can be broken into a segment that would be

Goals

The goal of this project is to clearly understand the uses and purposes QAM and hamming code

to a BPSK modulated signal. And the clear idea of using matlab is also emphasized here.

Page 8: Communication Modulations

COVENTRY UNIVERSITY

8

CHAPTER 3: QAM Background and Principal

3.1 Governing Principles

The fundamental definition of communication methodology is to transfer informative content from

any indicate any point, at whatever time and anyplace. In general, the communication framework

or communication channel is limited on this principle, but over the years this brainstorm is in

enduring enhancement. For instance, at the starting, individuals were utilizing blaze and drums as

indicators to transfer the qualified data, and this methodology just for little separation but now we

have enhanced communications frameworks now. Folks can talk and see one another from any

side or wherever on the earth, accurately, in the universe. Any communication framework,

basically built on these principals. Any QAM system, includes the following three parts shown as a

satellite communication diagram in Figure 3.1[refer block diagram for simplified version figure

3.2]

Figure 0-1: Satellite Communication Diagram (image courtesy to Wikipedia. org)

Page 9: Communication Modulations

COVENTRY UNIVERSITY

9

d

Figure 0-2: block diagram Communication system

Whenever the data or info signal transmits over the carrier. It’s called modulating signal. Consider

for example a QAM sinusoidal carrier signal. The signal is modulated according to the input data

the modification is done on the carrier wave

The operation of adjusting the amplitude of carrier means that modulation of the amplitude of

carrier is called Amplitude Modulation. The data signal becomes modulating signal. Similarly

when a data or modulating signal adjusting the phase or the frequency of the carrier it is called

Angle Modulation, see Figure 3-3, below.

Figure 0-3: QAM waveform(image courtesy to Google image sourse)

Source (transmitter) Destination (receiver)Transmission Media

Noise

Page 10: Communication Modulations

COVENTRY UNIVERSITY

10

3.2 Brief History of Evolution

M-ary Quadrature Amplitude Modulation more known as QAM was first introduced into the

market in the early 20th century.it was first designed as a method of transmitting complex digital

signals by the use of multilevel modulation. This technology was more concerned with signals

that were created out of more complex sources like speech or video encoding or data that was

more originated from computers and communication servers.

This method of modulation was more successful with signal encrypting and more so ever in

signal scrambling purposes. Where early military equipment’s like communication set and data

transmitters used this technology. This technology was taken further and hybrid adaptive

channel equalization was developed where the signal is set to deferent signal levels to reduce

and avoid long distance losses in communication sets. The source encoder may be used to

remove some of the redundancy which occurs in many sources such as speech, typically

reducing the transmission rate of the source.

3.3 Principle of Operations of Multilevel Digital Modulations

To first understand the operation of multilevel digital modulation we must first see why digital

modulation is used in the field of telecommunications and science

For all transmission to be possible there must be a possible transmission media where the signal

is generated (transmitter) and could travel for its intended destination were in communication we

call it as the receiver.

For all transmission media in communication there is only a static range of frequencies that is

available for transmission purpose, as this is available we could not possibly transmit in all

frequencies this could be disastrous, If a solution is not found and the data that we sent would not

be suitable for that channel. A successful scheme was found after extensive research is that to

alter a transmitting signal according to the information that is feed as input data, this alteration of

the signal is called as modulation. This data that is modulated could be received by the receiver

Page 11: Communication Modulations

COVENTRY UNIVERSITY

11

and the data that is inside the signal could be recovered as the original data that was encoded this

is called as demodulation. See Figure 3-4, below

Figure 0-4: wave Spectrum (image courtesy to Wikipedia. org)

Text Definition Text DefinitionLF Low frequency SHF Super high frequency

MF Medium frequency EHF Extremely high frequencyHF High frequencyUHF Ultra high frequency

Page 12: Communication Modulations

COVENTRY UNIVERSITY

12

CHAPTER 4: Principle of Operations of M-Qam Modulation

4.1 Detail of Operations

QAM is a modulation technique that is raised by the combination of PSK (Phase Shift Key) and

ASKS (Amplitude Shift Key) method. Therefore QAM has both the characteristics of PSK and

ASK in its carrier wave where the data is incorporated. However it is regarded as a PSK

waveform by specialist in the digital modulation world, But for the QAM modulator the carrier

wave is ASK modulated.

It is also possible and tested that two different signals could be transmitted on the same carrier

frequency by creating two identical copies of the same carrier frequency without harming or

cancellation of the original data signal that is to be transmitted; this is possible by the means of

shifting each wave by 90o QAM modulator block diagram See Figure 4-1, below

4.2 Detail of Functionality

For the functional scheme we could take that bit streams arrive at the serial to parallel converter

at time which is equal to T, then the bits are broken up and separated into two separate bit

streams where the data bits would enter D1 and D2 separately

Figure 5-1: wave Spectrum

Page 13: Communication Modulations

COVENTRY UNIVERSITY

13

The data in the upper stream is then ASK modulated on the carrier frequency by multiplying the

bit streams with the carrier

QAM Modulation equation ( ) = ( ) cos 2 + ( ) sin 2 In QAM modulation we can observer a special characteristic where if the numbers of

states are increased we could have a higher data rate for a given bandwidth

But at a certain number of states there will be higher possible error rate which would be

due to noise and attenuation

4.3 Waveform Illustration for Better Understanding

Figure 5-1: Provides Final transmission wave and combined wave cycles

Here two analog QAM carrier waves are generated each 90 degrees out of phase with each other.These two waves are further combined and transmitted.

Page 14: Communication Modulations

COVENTRY UNIVERSITY

14

CHAPTER 5: Parameters for Performance Measurement of M-Qam

M Modulation

Average Signal-to-Noise Ratio

Outage Probability Average Symbol Error Probability Noise power spectral density (W/Hz

Page 15: Communication Modulations

COVENTRY UNIVERSITY

15

CHAPTER 6: Design and Software Implementation

6.1.1 Design Calculations

Circuit design for an 8 QAM modulator has been given below. See Figure 5-1,

Figure 6-1, Cct design has been given above for an 8 QAM system

Figure 4-2.(a) block diagram

Figure 4-2.(b) truth table = 86.1.2 Calculate the number of bits per symbol k

Therefore with value ‘M’ given we could calculate number of symbols. This would be K

= log ( )= log ( 8)= 3

Page 16: Communication Modulations

COVENTRY UNIVERSITY

16

6.1.3 Phase calculation of wave design

6.1.4 Prepare a table for binary bits to symbols assignment. See Table 5-1, below

Bit Assignment Output

A B C Amplitude Phase

0 0 0 0.765 -135

0 0 1 1.848 -135

0 1 0 0.765 -45

0 1 1 1.848 -45

1 0 0 0.765 135

1 0 1 1.848 135

1 1 0 0.765 45

1 1 1 1.848 45

Table 5.1-Bit Assignment chart

Page 17: Communication Modulations

COVENTRY UNIVERSITY

17

6.1.5 Draw the constellation diagram for given 8 M_QAM modulations.

See Figure 5-2, below

Figure 6-2, Constellation Diagram,

6.1.6 Write a MATLAB program to simulate the designed M_QAM digitalmodulation in your simulation result, show the output modulated signal together withrelated input binary signal

Wave that would be used is a digital signal with an input combination of[000001010011100101110111] See Figure 5-3, below

Figure 6-3: Input digital signal

Matlab coding is stated below

format long;clcclear allM=8;

Page 18: Communication Modulations

COVENTRY UNIVERSITY

18

data='000001010011100101110111';A1=2; A2=4;f=2;t=linspace(0,1,900);time=[];Digital_signal=[];QAM_signal=[];N=length(data)/log2(M);phase=[0 0 pi/2 pi/2 pi pi (3*pi)/2 (3*pi)/2];phase_data=[];for k=1:3:length(data)

phase_data=[phase_data bin2dec(data(k:k+2))+1];endfor kk=1:1:N

QAM_signal=[QAM_signal (phase_data(kk)==1)*A1*sin(2*pi*f*t + phase(1))+...(phase_data(kk)==2)*A2*sin(2*pi*f*t + phase(2))+...(phase_data(kk)==3)*A1*sin(2*pi*f*t + phase(3))+...(phase_data(kk)==4)*A2*sin(2*pi*f*t + phase(4))+...(phase_data(kk)==5)*A1*sin(2*pi*f*t + phase(5))+...(phase_data(kk)==6)*A2*sin(2*pi*f*t + phase(6))+...(phase_data(kk)==7)*A1*sin(2*pi*f*t + phase(7))+...(phase_data(kk)==8)*A2*sin(2*pi*f*t + phase(8))];

time=[time t];t=t+1;

endt1=linspace(0,1/3,300);for jj=1:1:length(data)

Digital_signal = [Digital_signal(str2num(data(jj))==0)*zeros(1,length(t1))+...

(str2num(data(jj))==1)*ones(1,length(t1))];t1=t1+(1/3);

endsubplot(2,1,2);plot(time,QAM_signal,'.');title('8QAM Signal'); xlabel('time'); ylabel('Amplitude');axis([0 time(end) -8 8]);text(0.3,5.2,'\bf101');text(1.3,5.2,'\bf100');text(2.3,5.2,'\bf001');text(3.3,5.2,'\bf000');text(4.3,5.2,'\bf010');text(5.3,5.2,'\bf011');text(6.3,5.2,'\bf110');text(7.3,5.2,'\bf111');grid on;subplot(2,1,1);plot(time,Digital_signal,'LineWidth',3);title('Digital Input Signal'); xlabel('time'); ylabel('Amplitude');axis([0 time(end) 0 2]);grid on;text(0.3,1.3,'\bf101');text(1.3,1.3,'\bf100');text(2.3,1.3,'\bf001');text(3.3,1.3,'\bf000');text(4.3,1.3,'\bf010');text(5.3,1.3,'\bf011');

Page 19: Communication Modulations

COVENTRY UNIVERSITY

19

text(6.3,1.3,'\bf110');text(7.3,1.3,'\bf111');

6.1.7 Final output Modulated wave.

Figure 6-4: Input digital signal and output modulated wave

Page 20: Communication Modulations

COVENTRY UNIVERSITY

20

6.1.8 Screenshots

Figure 6-5: Input digital signal and output modulated wave

Page 21: Communication Modulations

COVENTRY UNIVERSITY

21

CHAPTER 7: ANALYSIS/ CONCLUSION ON RESULTS

7.1 Analysis

After the simulation and the mathematical parts have been solved we have come to a very

Important junction in QAM ,which states that the QAM modulator has a very stable operating and

control over the bits, and the power of this modulator is that it could transit two deferent waves

within the circuit which is a sine wave and cosine waveform in two deferent waveform angles.

Where this circuit takes great pride in altering the waveform output where it stays robustly even in

the AWGN channel.in a place more prone to noise

7.2 Conclusion

We now have a very steady idea of QAM modulators where it has been tested for M=8

modulation schemes, after going through the modulation design it is possible for a person to

understand its complexity. Not only in the calculation part but also in the circuitry part as well.

All stages of the modulator including the waveform has been tested for stability and it is working

at its full optimum levels. The waveform designed here is a just a test phase of a 8QAM system.

The increase of density and M value in the circuit could bring about another very important

technology that is to be used in world as a new technology tomorrow.

Page 22: Communication Modulations

COVENTRY UNIVERSITY

22

CHAPTER 8: Introduction to Forward Error Correction (FEC) Coding

8.1 Introduction

Within the first twentieth century audio, and data, as uninterrupted signals, were transmitted over

an analog channel. An analog network hosts a lot of noise. Channel noise and distortion has to be

and can be endured, if the precise communication does not need to be replicated.

Most of the exertion in the area of communications was done on analog channels and

technology in this era. With the dawn of computers and digital communication, in the second

part of the twentieth century, it became necessary to transmit information reliably. Digital

communications was used to replica original data at some point in the communication channel

Approaches and philosophies were advanced to convert digital data from analog signal, and then

digital data began to transmit over a digital communications channel. Finally, the ability of

digital data to be converted back to an analog signal at the receiver was attained after extensive

research in this area. The main benefit of the digital communication technology is an error free

transmission of digital data. Conveys were placed in the digital communication channel at

specific points and location to abstract the unique signal, before noise changes the signal to a

degree that the original signal may not be recoverable or receivable. These convey retransmit

data after they rearrange the data clearing and eliminating any sign of noise.

But later in time this technology became more prone to interference and error therefore many

error correcting mechanisms were introduced.

Page 23: Communication Modulations

COVENTRY UNIVERSITY

23

CHAPTER 9: Principles for Forward Error Correction (FEC)

9.1Principles of the FEC

Bit errors occur autonomously of the former errors, but burst errors occur most of the time in

contiguous bits. This is known as Burst error length. Burst error length means the difference in

positions of the first bit in error to the last bit in error. An error vector can be in symbolizing bit

errors where a 1 indicates a bit error and 0 indicates no error at that position.

For us to understand FEC we must first look at Shannon limit

What really is Shannon limit?

The Shannon limit provides a higher boundary for the amount of signals that can possible

propagate through a communication channel with randomly low BER; however, it is still

possible that transmission of data in a channel could be kept well below Shannon’s limit. The

BER below Shannon’s limit cannot be randomly low while some data is still beginning

transmitted from the source to the destination

The Hamming distance d(a, b) delivers us the determined possibility decision Assume a FEC

with least Hamming distance D, the number of code words L, and code length N. Without loss of

data, assume that all 0 code word were transmitted and received

Now let’s come back to the Burst error length See Figure 8-1, below

Figure 9-1, Burst error length (image courtesy of wekepedia.org)

Page 24: Communication Modulations

COVENTRY UNIVERSITY

24

9.2 Performance Measurement Parameters For (FEC) Coding

9.2.1 SNR

The SNR value signifies the quantity of power required to attain a certain BER rate. Generally a

bigger SNR value results in lower BER. Coding gain is defined as the amount of enhancement

and quality in SNR, when a particular coding scheme is used. The normal method of finding

code gain is to plot the BER versus SNR for both coded and un coded system,

+ 1 ≈ = 2Equation for SNR calculation

9.2.2 Minimum Distance

The minimum distance provides us a security against noise and attenuations. This mechanism the

minimum distance between code words can be used for error detection and/or error correction.

The fail-safe mechanism of error detection, and or correction capability of a FEC are determined

by only on the minimum distance of the FEC. This could be worked out on two ways that can be

that we can reduce the number of error corrections and or increase the number of error detections

or the other way round.

This is also known as the hamming distance. The hamming distance is obtained by the minimum

distance between any two codewords

( , ) = ( , ) ℎ ( , ) = 1 ≠0 =Equation for Minimum Distance calculation (Courtesy of University of Florida)

Page 25: Communication Modulations

COVENTRY UNIVERSITY

25

CHAPTER 10: Principles for Hamming Coding and Decoding

10.1Hamming Coding

Within side telecommunication, Hamming codes undoubtedly absolutely would definitely be a

family of linear error-correcting codes in which generalize the Hamming (7, 4)-code created by

Richard Hamming throughout 1950. Hamming codes can detect as much as two and proper

around a single bit errors. By contrast, the straightforward reason parity code can't correct

mistakes, and will detect just an odd quantity of mistakes. Hamming codes are special because

they may be perfect rules, that is, they will reach the highest possible value regarding rules

making use of their obstruct length and also minimum distance

Due to the simpleness regarding Hamming codes, they are trusted throughout computer memory.

With this circumstance, one usually makes use of an extended Hamming signal with one extra

parity bit. Lengthy Hamming codes accomplish the range associated with, which allows the

particular decoder to distinguish involving the scenario by which at most one bit error occurred

as well as the situation by which 2 bit problems happened. With this feeling, prolonged

Hamming codes tend to be single-error repairing and double-error sensing, and often referred to

as SECDED

When more error-correcting parts are included with a message, and when those bits could be

organized such that different incorrect bits create diverse error final benefits, then poor pieces

could be recognized. In the 7-bit information, you can find more effective feasible individual bit

problems, therefore 3 error manage bits might specify not just that an error took place but also

which usually bit caused the error.

Hamming researched the prevailing programming schemes, such as two-of-five, and also

generalized their particular ideas. To start with, he developed a nomenclature to spell it out the

system, including the number of data bits as well as error-correction bits in a prevent. As an

example, equality includes a solitary bit for almost any data term, thus presuming ASCII phrases

having 7-bits

Page 26: Communication Modulations

COVENTRY UNIVERSITY

26

Hamming described this as an (8, 7) signal, along together using ten pieces as a whole, which

Seven are usually info. The actual repeating instance could be (3,1), following the same logic.

The signal rates are the next number split by the first

Hamming also seen the problems having flicking a couple of bits, and referred to this particular

because the "range" (. Equality features a distance of two; just like any a couple of bit flips will

be invisible. The particular (3,1) repetition includes a distance of 3, because three parts have to

be turned inside same double to acquire one more code word without any visible mistakes. A

(4,1) repetition (each and every bit is repeated 4 times) features a range of four, therefore

flipping a couple of pieces could be detected, although not adjusted. Whenever 3 pieces flip in

the very similar group there may be circumstances the location the place that the code adjusts

towards the incorrect code word.

Page 27: Communication Modulations

COVENTRY UNIVERSITY

27

CHAPTER 11: Design and Software Implementation

11.1 Value selection for (n , k)

Value provided by Institute = 3= log ( + 1)11.2 Value of n = 2 − 1= 2 − 1= 711.3 Value of K = −= 7 − 3= 411.4 Number of check bits == 3

As now we are aware that this is a (7, 4), by this data 4 information bits and we would need to

add 3 parity bits to build a 7 bits code. There can be seven usable combinations of the three bit

parity matrix

000

001

010

011

100

Page 28: Communication Modulations

COVENTRY UNIVERSITY

28

101

110

111

11.5 Construction of the matrix algebra can proceed=G matrix has been constructed See Figure 10-1, below= ( | )

= ( | ) = 1 0 0 0 0 0 10 1 0 0 1 1 10 0 1 0 1 1 00 0 0 1 1 1 111.6 H matrix has been constructed

= ( ) = 1 1 0 1 1 0 0 01 0 1 1 0 1 0 01 1 1 0 0 0 1 00 1 1 1 0 0 0 111.7 Identity matrix = [ × ]

Parity check matrix. = [ × ( − )]Since identity matrix, the first coded bits are identical to source message bits and the

remaining bits form the parity check matrix.

Parity equation

Page 29: Communication Modulations

COVENTRY UNIVERSITY

29

11.8 Codewords table

numbers M0 M1 M2 M3 P0 P1 P2 Codeweigh0 0 0 0 0 0 0 0 01 0 0 0 1 0 1 1 32 0 0 1 0 1 1 0 33 0 0 1 1 1 0 1 44 0 1 0 0 1 1 1 45 0 1 0 1 1 0 0 36 0 1 1 0 0 0 1 37 0 1 1 1 0 1 0 48 1 0 0 0 1 0 1 39 1 0 0 1 1 1 0 410 1 0 1 0 0 1 1 411 1 0 1 1 0 0 0 312 1 1 0 0 0 1 0 313 1 1 0 1 0 0 1 414 1 1 1 0 1 0 0 415 1 1 1 1 1 1 1 7

Minimum distance = ℎ= 310.8.1 Simulation for hard decision decoding

%Simulation for encoding and decoding of a [7,4] Hamming code. The decoder

clearn = 7%# of codeword bits per blockk = 4%# of message bits per blockA = [ 1 1 1;1 1 0;1 0 1;0 1 1 ];%Parity submatrix-Need binary(decimalcombination of 7,6,5,3)G = [ eye(k) A ]%Generator matrixH = [ A' eye(n-k) ]%Parity-check matrix

% ENCODER%msg = [ 1 1 1 1 ] %Message block vector-change to any 4 bit sequencecode = mod(msg*G,2)%Encode message

code(2)= ~code(2);

Page 30: Communication Modulations

COVENTRY UNIVERSITY

30

recd = code %Received codeword with error

% DECODER%

syndrome = mod(recd * H',2)%Find position of the error in codeword (index)find = 0;for ii = 1:n

if ~finderrvect = zeros(1,n);errvect(ii) = 1;search = mod(errvect * H',2);if search == syndrome

find = 1;index = ii;

endend

enddisp(['Position of error in codeword=',num2str(index)]);correctedcode = recd;correctedcode(index) = mod(recd(index)+1,2)%Corrected codeword%Strip off parity bitsmsg_decoded=correctedcode;msg_decoded=msg_decoded(1:4)

10.8.2 Simulation for comparison of Bit Error Rate (BER) for coded and uncoded

signals

% Script for computing BER with Hamming (7,4) code and maximal% likelihood hard decision decoding

clearN = 10^6 ;% number of bits

Eb_N0_dB = [0:1:10]; % multiple Eb/N0 valuesEc_N0_dB = Eb_N0_dB - 10*log10(7/4);

h = [ 1 0 1 ; 1 1 1; 1 1 0; 0 1 1];ht = [h ;eye(3)];g = [eye(4) h];synRef = [ 5 7 6 3 ];bitIdx = [ 7 7 4 7 1 3 2].';

for yy = 1:length(Eb_N0_dB)

% Transmitterip = rand(1,N)>0.5; % generating 0,1 with equal probability

% Hamming coding (7,4)

Page 31: Communication Modulations

COVENTRY UNIVERSITY

31

ipM = reshape(ip,4,N/4).';ipC = mod(ipM*g,2);cip = reshape(ipC.',1,N/4*7);

% Modulations = 2*cip-1; % BPSK modulation 0 -> -1; 1 -> 0

% Channel - AWGNn = 1/sqrt(2)*[randn(size(cip)) + j*randn(size(cip))]; % white gaussian noise, 0dB variance

% Noise additiony = s + 10^(-Ec_N0_dB(yy)/20)*n; % additive white gaussian noise

% ReceivercipHard = real(y)>0; % hard decision

% Hamming decodercipHardM = reshape(cipHard,7,N/4).';syndrome = mod(cipHardM*ht,2); % find the syndromesyndromeDec = sum(syndrome.*kron(ones(N/4,1),[4 2 1]),2); % converting the three bit syndrom to

decimalsyndromeDec(find(syndromeDec==0)) = 1; % to prevent simulation crash, assigning no error bits to

paritybitCorrIdx = bitIdx(syndromeDec); % find the bits to correctbitCorrIdx = bitCorrIdx + [0:N/4-1].'*7; % finding the index in the arraycipHard(bitCorrIdx) = ~cipHard(bitCorrIdx); % correcting bitsidx = kron(ones(1,N/4),[1:4]) + kron([0:N/4-1]*7,ones(1,4)); % index of data bitsipHat = cipHard(idx); % selecting data bits

% counting the errorsnErr(yy) = size(find([ip- ipHat]),2);

end

theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber uncoded AWGNsimBer = nErr/N;

close allfiguresemilogy(Eb_N0_dB,theoryBer,'bd-','LineWidth',2);hold onsemilogy(Eb_N0_dB,simBer,'ms-','LineWidth',2);axis([0 10 10^-5 0.5])grid onlegend('theory - uncoded', 'simulation - Hamming 7,4 (hard)');xlabel('Eb/No, dB');

Page 32: Communication Modulations

COVENTRY UNIVERSITY

32

ylabel('Bit Error Rate');title('BER for BPSK in AWGN with Hamming (7,4) code');

10.8.3 BER simulation files See Figure 4-1, below

See Figure 4-1 Bit error Rate vs. Eb/No

Page 33: Communication Modulations

COVENTRY UNIVERSITY

33

CHAPTER 12: ANALYSIS/ CONCLUSION ON RESULTS

12.1. Analysis and Conclusion

We will discuss the simulation results. The hamming code is an optimized bitwise FEC for the

Gaussian channel. Many transmission schemes contain burst errors where they occur extremely

in adjacent bits. The channel inbuilt nature sometimes is used to correct short burst errors. The

channel interleaves tries to allocate burst errors randomly within a block of data where they may

be corrected by a suitable random FEC at the receivers end, such as Hamming code. In this

coursework we have seen such a situation. The main part is that the calculation of BER where it

shows us the error rate at particular Eb/No. where it shows that an uncoded system has small

error rate at start where Eb/no are small. But when the graph moves out a large power Is required

to maintain the error rate same with the coded system

Page 34: Communication Modulations

COVENTRY UNIVERSITY

34

Tunitin report