Encoder Viterbi Matlab

Implementation of Convolutional Encoder and Viterbi Decoder Appliance Matlab and FPGA

Abstract

Channel coding is broadly acclimated in agenda communication. By appliance approach encoding methods we can abbreviate arresting babble and arresting arrest in our system. These techniques additionally beforehand beneath bandwidth for absurdity chargeless transmission. In our activity we accept implemented convolutional encoder and viterbi decoder for approach coding. Convolutional encoding is awfully acclimated for absurdity alteration in agenda communication. We accept implemented these techniques on matlab and performed a lot of simulation to analysis their performance.

Chapter 1 DIGITAL COMMUNICATION SYSTEM

  • INTRODUCTION

Early advice was based on absolute acceptance that letters arresting is connected capricious time arresting waveform. Such connected time signals are referred as analog signals and there agnate advice sources are alleged analog sources. Analog signals are transmitted appliance carrier accentuation over advice approach and appropriately demodulated at receiver. Such advice arrangement is alleged analog advice systems. In agenda manual analog antecedent achievement is adapted to agenda form. Bulletin can be transmitted appliance agenda accentuation and at receiver demodulated as agenda signal.

The basal affection of agenda advice arrangement is that during bound breach of time it sends a waveform from accessible cardinal of waveforms. Important admeasurement of arrangement achievement in agenda advice systems is anticipation of error.

1.2 WHY DIGITAL COMMUNICATION

Digital advice is adopted over analog advice because agenda circuits accept a beneath anticipation of baloney and arrest than analog. Agenda circuits are reliable than analog and accept low cost. Agenda accouterments is added adjustable to apparatus than analog. In agenda signals time analysis multiplexing is simpler again FDM in analog signals.

  • DIGITAL COMMUNICATION

In agenda advice arrangement anatomic operations performed at both transmitter and receiver should be broadcast to add letters arresting bent at transmitter and bulletin arresting amalgam or interpolating at receiver. Added functions accommodate back-up abatement and approach encoding and decoding.

1.3.1 Antecedent Nature

Information is knowledge. Advice can be of two types either analog or digital. We can aggregate advice through alert or watching. Receiver newer apperceive what it will accept in beforehand but alone aback some antecedent generates an achievement appear it. The capital albatross on any advice approach is to accelerate absurdity beneath advice appear receiver.

1.3.3 Antecedent Encoder/Decoder

What is antecedent encoder? It is a address which changes an analog arresting into arrangement of bits. This arrangement of $.25 that is produced can additionally be acclimated for the about-face of the signal. These $.25 accommodate advice about the aboriginal signal. If we use this encoding address it can additionally be accessible in adapted bandwidth utilization. The arrangement of $.25 is such that it can be acclimated for abstracts compression.

1.3.4 Quantization

It is a action in which we sample the amplitude of a analog signal. Irreversible apparatus in which we erradicate bombastic $.25 is alleged QUANTIZERS. The disadvantage of quantization is that it introduces babble in the sampled signal. Whereas while sampling baloney donot occur. But inspite of all that, quantizers and quantization is still broadly acclimated in free the bit rate. And in any coding action of speech, amplitude quantization is the best important step.

X8

X7

X6

X5

X4

X3

X2

X1

Figure 1.2: 8-level quantization

1.3.5 Accentuation and Demodulation

What is accentuation and demodulation? Accentuation is a action in which a baseband arresting is alloyed with a carier and adapted into bandpass signal. And demodulation is a action in which aboriginal arresting is recovered from articulate signal.

And modulator and demodulators accomplish the aloft information. The modulator changes the arresting into the anatomy apery the appropriate information. And about-face operation is performed by demodulator. The purpose of these accessories is to aftermath and aback letters with minimum bit absurdity rate.

  • NOISE IN COMMUNICATION SYSTEMS

Noise refers to article which is consistently present in the absolute advice world. Babble is article that can be created or produced from arrangement of possessions. If babble is present in any arrangement it makes the arrangement cryptic and beneath efficient. It additionally makes our receiver adequacy beneath efficient. And accordingly additionally borders the manual rate.

Noise can be minimized by able designing address which is not adapted through altered methods such as filtering. Babble which is acquired by the thermal motion of electrons in all careless resistors is alleged thermal noise. These electrons are additionally amenable for thermal babble as a aught beggarly Gaussian accidental process.

CHAPTER 2 CHANNEL CODING

2.1 INTRODUCTION

Channel coding is acclimated in advice arrangement to beforehand the arresting believability in advice systems. By assuming approach coding we can assure our arresting from altered types of noises and distortion. These methods of arresting processing are accoutrement for accomplishing adorable arrangement tradeoffs. By appliance ample calibration chip ambit and aerial acceleration agenda processing methods it had fabricated accessible to accommodate as abundant as 10db achievement beforehand at abundant beneath cost.

Shannon showed that by the accession of bombastic $.25 to antecedent advice we acquaint a adjustment to abbreviate absurdity in approach afterwards advancing advice manual amount provided that the advice amount is beneath than approach capacity. Average cardinal of advice $.25 per assemblage time can be bargain by appliance action of the accent code. Minimum cardinal of advice $.25 should be transmitted. The ascribe to encoder is the achievement of accent code. Radio articulation achievement is bigger by appliance Approach coding in adaptable advice by the accession of bombastic $.25 to antecedent information. At the transmitter approach cipher maps the agenda advice which is produced by a abstracts antecedent into a anatomy that can be decoded by the receiver with minimum errors.

Channel coding apparatus admit babble to the codes in a controlled address by abacus added $.25 so that the receiver can do apprehension and alteration in a blatant channel.

Channel codes which are produced are classified as block codes and coil codes

The assuming ambit (minimum), dmin of a cipher is acclimated as belief for free absurdity alteration ability. The minimum assuming ambit is authentic as aboriginal amount of d. if minimum assuming ambit is dmin ,(dmin -1)bit errors can be detected and we actual the accumulation [(dmin-1)/2] bit errors .raw abstracts manual amount can be bargain added coded bits.

  • Appliance Error-Correction Codes

These codes are actual advantageous to use.Without implementing these codes in our advice arrangement our abstracts delievered will be actual blatant and corrupted.Below is the blueprint which showz allegory amid uncoded and coded abstracts absurdity performance.

Chapter 3 CONVLUTIONAL CODING

  • INTRODUCTION TO CONVOLUTIONAL ENCODING

The abstraction is to accomplish all cipher chat symbols to be the abounding sum of the ascribe bulletin symbols. And that is agnate to the coil acclimated in beeline time invariant systems area the achievement of arrangement is found, if you apperceive about the ascribe and actuation response.

So in convolutional encoder we usually get the achievement of the system, by convolving the ascribe bits. Basically, convolutional codes do not abate abundant babble as compared to an agnate block code. In best of the cases, they about action added simple accomplishing aloft block cipher of aforementioned power. The encoder is a simple ambit which contains the anamnesis states and acknowledgment logic, frequently accurate by XOR gates. The decoder is usually implemented in software.

The Viterbi algorithm is the best favourable algorithm which is acclimated to break convolutional codes. It is begin that they about accord acceptable after-effects in ambiance of lower noise.

  • OVERVIEW OF CONVOLUTIONAL CODES

Convolution codes represent one adjustment aural the accepted chic of codes. Approach codes which are additionally alleged error-correction codes acquiesce reliable advice of an advice arrangement over that approach which adds noise, accompany in bit errors, or contrarily batter the transmitted signal. These codes accept abounding applications which accommodate deep-space advice and articulation bandage modems. Convolutional codes are frequently précised by the afterward three parameters; (n, k, m).

n = achievement bits

k = ascribe bits

m= anamnesis registers

L=constraint length

The abundance k/n which is alleged cipher amount is a admeasurement of the adequacy of the codes. Usually ambit of n and k is from 1 to 8 and ambit of m is from 2 to 10 and the cipher amount from 1/8 to 7/8 except for abysmal amplitude appliance area the cipher ante as low as 1/100 or alike best has been engaged.

Often the articles of the Convolutional cipher chips specify the codes by the afterward ambit n, k, L. The abundance L is the coercion breadth of the cipher and is authentic by Coercion length, L = k*(m-1).

The coercion breadth L angle for the $.25 in the encoder anamnesis that furnishings the assembly of n achievement bits. The coercion breadth L is additionally adumbrated by the letter K.

3.2.1 CONVOLUTIONAL ENCODING

  • ENCODER STRUCTURE

Convolutional codes assure by abacus exceptionable $.25 as any bifold code. A amount k/n Convolutional encoder develops the ascribe alternation of k-bit advice symbols through one or added bifold about-face registers. The convolutional encoder calculates every n-bits representation (n > k) of the achievement alternation from beeline action on the present ascribe attribute and the capacity of the about-face register(s).

Therefore, a k-bit ascribe attribute is candy by a amount k/n convolutional encoder and computes an n-bit out put attribute with every about-face update. Amount shows a non recursive convolutional encoder accepting amount of 1/2.

For the encoder above, shows accompaniment variations and consistent achievement cipher words. Arrangement U for the bulletin arrangement m=1 1 0 1 1

Solution

Table 3.1

Branch chat at time ti

u1 u2

State at

Time ti+1

State at

Time ti

Register

Contents

Input

Bit mi

0 0

0 0

0 0 0

1

1

1 0

0 0

1 0 0

1

1

0

1 1

1 0

1 1 0

1

1

0

0 1

1 1

0 1 1

0

0

0

1 0

0 1

1 0 1

1

1

0

1 1

1 0

1 1 0

1

1

0

0 1

1 1

0 1 1

0

1

1

0 0

0 1

0 0 1

0

U = 1 1 0 1 0 1 0 0 0 1 0 1 1 1

  • POLYNOMIAL REPRESENTATION

Sometimes, the encoder characters are characterized by architect polynomial. Representation of an encoder can be done with a set of n architect polynomial, one for anniversary of the n modulo-2 adders. Anniversary polynomial is of amount K-1 or beneath and acquaint about the affiliation of encoding about-face annals to that modulo-2 adder as the affiliation agent frequently do. The accessory of all the agreement is either 1 or 0 of the amount polynomial depending aloft whether affiliation exists or doesn’t. For archetype in amount 4.1, we can address the architect polynomial g1(X) for the high access and g2(X) for the lower access as follow.

g1(X) = 1+X+X2

g2(X) = 1+ X2

The achievement arrangement is begin as chase

U(X) = m(X) g1(X) interlaced with m(X) g2(X)

Let the bulletin agent m = 101 as a polynomial is represented as m(X) = 1+ X2

Then achievement polynomial U(X), of the amount 4.1 encoder can be affected for the ascribe bulletin m is accustomed as under.

m(X) g1(X) = (1+ X2 )( 1+X+X2) = 1+X+X3+X4

m(X) g2(X) = (1+ X2 ) (1+ X2 ) = 1+ X4

m(X) g1(X) = 1+X+0X2+X3+X4

m(X) g2(X) = 1+0X+0X2+0X3+ X4

U(X) = (1, 1) + (1, 0) X + (0, 0) X2 + (1, 0) X3 + (1, 1) X4

U = 11 10 00 10 11

We approved the encoder with polynomial initiators as additionally declared for circadian codes.

Graphically there are three means in which we can attending at the encoder to accretion bigger compassionate of its operations. These are

(a) Accompaniment diagram

(b) Timberline diagram

(c) Filigree diagram

3.2.2 STATE DIAGRAM

Convolution encoders are finite-state technology. Hence accompaniment diagram offers cogent acumen into their performance. The states showed in the diagram betoken the apparent capacity of appropriate best K-1 stages of register, and paths represent the achievement symbols advancing from such accompaniment changes. The states of registers are nominated as a=00, b=10, c=01 and d=11.

There are alone two conversions basic from every state, agnate to two apparent ascribe bits. Achievement annex chat is accounting abutting to every aisle accompaniment that is affiliated with the accompaniment transition. In beneath figure, we accept acclimated the complete band which denotes a aisle affiliated with ascribe bit, 0 and a doted band is to a aisle with an ascribe bit, 1. Beam that it is absurd in a distinct alteration accompaniment to move advanced from a accustomed accompaniment to any accidental state.

3.2.3 THE TREE DIAGRAM

One cannot calmly use the accompaniment diagram for archetype aback the encoder transitions as a action of time because it has alone one disadvantage i.e. it cannot beforehand the history almanac while the accompaniment diagram absolutely characterize encoder. Accompaniment diagram is the beforehand anatomy of timberline diagram; it adds the ambit of time than timberline diagram. As the custom these copse additionally bisect from larboard to appropriate at anniversary bit inputs and anniversary annex of the timberline is anecdotic the achievement branch. Afterward aphorism can be acclimated to acquisition the arrangement of codeword; for an ascribe bit of zero, its accompanying annex chat can be acquired by advancing to consecutive rightmost annex in the up direction. For an ascribe bit of 1, its annex chat can be acquired in the bottomward direction. If we accept that the above capacity of encoder are zeros, the diagram shows if antecedent ascribe bit to the encoder is set to zero, the achievement will be 00 and if the antecedent ascribe bit is a one, the achievement will be 11. Additionally if the antecedent bit ascribe is one and abutting ascribe is zero, the abutting achievement bit is one; the abutting achievement annex chat is 01.By afterward these accomplish we beam that ascribe bit beck 11011 traces adventurous band on the tree. This aisle matches to the achievement codeword arrangement 1101010001.

CHAPTER 4 VITERBI DECODER

4.1 VITERBI DECODING ALGORITHM

This algorithm was appear by Viterbi in 1967. The Viterbi algorithm performs best likelihood decoding. By demography account of the anatomy in the cipher filigree it additionally reduces the computational load. The account of Viterbi adaptation is that its adversity is not a action of the advice of symbols in the cipher chat sequence. The algorithm includes artful a distance, or admeasurement of affinity b/w the accustomed signal, and every the filigree paths entering anniversary accompaniment at the aforementioned time. Those filigree paths that could not possibly by candidates for the best likelihood choice, viterbi algorithm removes them from application aback two paths are entering the aforementioned accompaniment again the one accepting the best metric is alleged and that aisle is alleged the actual path. This best of actual aisle is backpack out for every state. The complication of the decoder is bargain by the abolish paths with best unlikeliness. The decoder continues in this way to go advanced into the filigree and authoritative accommodation by eradicating the aboriginal acceptable paths. In actuality in 1969, Omura additionally approved that the Viterbi algorithm is best likelihood. The cold of selecting the optimum aisle can be articulate by selecting codeword which as minimum ambit metric.

4.2 EXAMPLE OF VITERBI CONVOLUTIONAL DECODING

Binary Symmetric Approach is affected for artlessness appropriately assuming ambit is a acceptable abstinent ambit .A agnate filigree which we are appliance in encoder can additionally be acclimated in decoder, as apparent in amount 4.5. We set up at time t1 in 00 accompaniment apropos to filigree diagram. Flushing in encoder is actual important because it tells the decoder about the starting accompaniment because in this archetype there are alone two acceptable transitions abandonment any accompaniment and not all the branches charge to apparent firstly. The abounding filigree anatomy starts afterwards time t3. Central abstraction afterward the adaptation action can be approved by seeing the amount 4.1 encoder filigree in adverse with the amount 4.2 decoder trellis. It is acceptable at anniversary time interval, for the decoder to characterization every annex with assuming ambit b/w the accustomed ascribe cipher symbols and the accepted alteration chat analogous to the aforementioned alteration at encoder end. The archetype in amount 4.2 shows the agnate codeword arrangement U, a bulletin arrangement m, and a babble adulterated accustomed arrangement Z = 11 01 01 10 01 ……. . Cipher symbols that will appear from the encoder achievement which are after-effects of accompaniment transitions are the encoder annex words

As the cipher symbols are accustomed they are accumulated by the decoder and are labeled on filigree branch. That is for anniversary and every annex of the decoder filigree it will be apparent with a cast of likeliness i.e. Assuming distance. From the accustomed arrangement Z, we beam that cipher symbols accustomed as the convolutional achievement at time t1 are 11, apparent in amount 4.2. With the aim of labeling the decoder branches at time t1 with the atomic Assuming ambit metric, we glance at the encoder accompaniment diagram amount encoder trellis. At this point we beam that a accompaniment 00-00 alteration gives an achievement annex chat of 00, but we are accepting 11.

Consequently, on the decoder filigree we characterization 00—00 alteration with assuming ambit of 0. Observing encoder trellis, a accompaniment 00—10 alteration yields an assuming ambit of 1 with the achievement of 11. Hence, on the decoder trellis, we additionally characterization the accompaniment 00—01 alteration with a Assuming ambit of 0.

So, the metric entered on the decoder filigree annex tells compares the besmirched and actual distances accustomed associated with the annex transmitted with the annex word. To all intents and purposes, these metrics describes a correlation. The adaptation algorithm finds the minimum ambit aisle in adjustment to accurately break the data. The foundation of Viterbi adaptation is that amid any two paths which are catastrophe up to the aforementioned state, aisle with minimum assuming ambit will consistently be alleged and alternative one will be discarded. Its archetype can be apparent in amount 4.3 below.

4.3 Decoder Implementation

In the adaptation ambience the transitions during any of the time breach can be accumulated into 2^v-1 break cells, area anniversary corpuscle is administration four of the accessible transitions, area v is alleged the encoder memory.

4.3.1 Add-Compare-Select Computation

Starting with the K=3, 2—cell example, amount 4.4 beneath shows the argumentation assemblage that corresponds to corpuscle 1. The argumentation executes the appropriate purpose abacus alleged add-compare-select (ACS). The accompaniment metric is affected by abacus the previous-time accompaniment metric of accompaniment a, to the annex metric and the previous-time accompaniment metric of accompaniment c, to the annex metric, this fallout in two accessible aisle metrics as candidates for the new accompaniment metric. These two after-effects are compared in the argumentation units of amount 4.4. The better likelihood (smallest distance) of the two aisle metrics is adored as the new accompaniment metric for the accompaniment a. Additionally apparent in the amount 4.4 is the cell-1 add analyze baddest argumentation that tells the new accompaniment metric and the new aisle history. This ACS action is additionally performed for the paths in alternative cells. The oldest bit on the aisle with the aboriginal accompaniment metric forms the decoder output.

4.3.2 Add-compare-select as apparent Filigree

Consider the aforementioned archetype for anecdotic viterbi decoding. The codeword arrangement was U = 1101010001, the bulletin arrangement was m = 11011 and accustomed was Z = 1101011001. Amount 4.5 accord a account of a adaptation filigree diagram. Best important point in the adaptation through filigree timberline is its assuming distance. This is the ambit amid accustomed cipher symbols and their agnate annex words. Filigree tells the amount at every accompaniment x and for anniversary time to time t1 to t6. We do ACS operation aback we accept two transitions catastrophe up to the aforementioned state. And we get these types of situations afterwards t4 alteration and afterwards that. For instance at time t4 the amount for the accompaniment metric is acquired by incrementing allay t3. Agnate operation is done for the accompaniment t2. The ACS action chose the minimum assuming ambit aisle which additionally has best likelihood. The paths with minimum assuming distances are apparent with adventurous curve and the paths with minimum likelihood are apparent with achromatic lines. Filigree copse are consistently empiric from larboard to right. At any time aback we appetite to analysis our decoder achievement we admit with those states which has aboriginal paths.

If we attending at the amount beneath we can see that at time t6 aisle with minimum assuming ambit has survived with ambit =1.

CHAPTER 5 SIMULATION METHODOLOGY

5.1 MATLAB SIMULATION

5.1.1 CONVOLUTONAL ENCODER & VERTERBI DECODER

We accept implemented Convolutional encoder and viterbi decoder as antecedent code. Matlab cipher additionally compares our viterbi decoder achievement with the congenital in decoder achievement by comparing bit absurdity ante in our project. Authoritative Matlab cipher and breeding altered cipher words for altered symbols appliance convolutional codes and again adaptation them with errors appliance viterbi decoder was the aboriginal footfall in our project.

We accept taken ascribe from the user which will be coded by the convolutional encoder. Here we accept generated accidental bits. Again the coded abstracts will be decoded at the viterbi decoder. At the decoder ancillary we accept besmirched altered $.25 by artlessly inverting them manually. Just to analysis what will be the bit absurdity amount if altered $.25 will be corrupted. Again we accept compared our congenital in decoder action with our decoder cipher efficiency.

In the receiver ancillary we accept acclimated viterbi adaptation algorithm to break the transmitted signal. Afterwards these two accomplish (encoding and decoding) aboriginal abstracts is obtained, which accept errors if low SNR is used.

5.2 VHDL SIMULATION

Our additional footfall apropos to this activity was to accomplish synthesizable cipher of encoder and decoder in vhdl. For this we accept acclimated modelsim. Here we accept implemented aforementioned argumentation as we acclimated in matlab.

5.3 FPGA

In the end we accept austere our cipher in acreage programmable aboideau array. We fabricated a synthesizable cipher in vhdl of our matlab argumentation and implemented on fpga.

  • MATLAB RESULTS

Here is the aftereffect of our matlab codes.

  • If one bit is corrupted

data_str =

111011010101000001111101101010101000101100111011010001000100011001111111110101100010101111100101010011101011101001000110

conv_code_str =

100110010001000010001000111100000011001010100100000100100010011000101100101000010111100110010001000010110011111100111011011101011111001010101010111001001000000111001110011000011010110111111000110010111101110100100001110100101111111100110101

msg_rec =

11101101010100000111110110 101010100010110011101 10100010 0010001 10 011 1111111010110001010111110 0101010 01110101110 1001000110

Message/ber retrieved with Verterbi_link_cont1

ber = 0

Message/ber retrieved with Vitdec

ber =0

  • If two $.25 are corrupted

data_str =

100010111000000011101000101100010010100110101101110110110010001100010010010011111001100001101000001001111000101011011101

conv_code_str =

100011001110011110011100011000001101111100101100100000010111010110111110010011110101010000010100000001000101011101111110101011010111010110111110100110111101110010011111001111000011001100101100011011101111000010011100100000100001001001100100

msg_rec =

10001011100000001110100010110001001010011010110 1110110110 0 10

001100010 010010011111001100001101000 001 0011110001 010110 11 1 0 1

Message/ber retrieved with Verterbi_link_cont1

ber = 0

Message/ber retrieved with Vitdec

ber = 0.2667

  • if 3 $.25 are corrupted

data_str =

101100011101110010110100100110010010001010111010011011111000000000110110000110101111100000100010100011001001111110001100

conv_code_str =

100110010111010011100100000111111110011011001011100101110101100000111110101101100010011000010010100011010001110100011100011110000000101011000101101110110101010110011010111001000000100101001110010101001101000001101111000100101001101101010111

msg_rec =

1110011111 01110 0 1 0 11010010011011 0 01010101011101 000 111 011 10 00100000110110100110111010100000100010 11011001110 0111110101100

Message/ber retrieved with Verterbi_link_cont1

ber = 0.1750

Message/ber retrieved with Vitdec

ber = 0.2000

As the errors in $.25 increases bit absurdity amount additionally increases.

Appendix A

Matlab Code

%***********************************************************************************

%** CONVOLUTIONAL ENCODING TRELLIS DIAGRAM IMPLEMENTATION %************************************************************************************

function [code]= Conv_Enc(message1)

% K=3 Breadth of About-face Register

% # of states = 2^(K-1) = 4

% Accompaniment can be advised as aboriginal two or aftermost two $.25 of the about-face register

% 1/n Convolutional Encoder, Amount = 1/2

% n= breadth of generated codeword

for i=1:length(message1)

message(i)= num2str(message1(i));

end

state=’00’;

next_state=’00’;

code1=[];

message=[message ’00’];

message=[message];

for t=1:length(message)

inp= message(t);

state=next_state;

if(state==’00’)

if(inp==’0′)

next_state=’00’;

outp=’00’;

else

next_state=’10’;

outp= ’11’;

end

elseif(state==’10’)

if(inp==’0′)

next_state=’01’;

outp=’10’;

else

next_state=’11’;

outp= ’01’;

end

elseif(state==’01’)

if(inp==’0′)

next_state=’00’;

outp=’11’;

else

next_state=’10’;

outp= ’00’;

end

elseif(state==’11’)

if(inp==’0′)

next_state=’01’;

outp=’01’;

else

next_state=’11’;

outp= ’10’;

end

end

code1= [code1 outp];

end

for i=1:length(code1)

code(i)= str2num(code1(i));

end

% code=code1;

%***********************************************************************************

%***************** DECODER IMPLEMENTATION*********************** %************************************************************************************

function [messa

Order a unique copy of this paper

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
Top Academic Writers Ready to Help
with Your Research Proposal
Live Chat+1(978) 822-0999EmailWhatsApp

Order your essay today and save 20% with the discount code COURSEGUY