deteksi dan koreksi pada kode siklik

Post on 24-Oct-2015

56 Views

Category:

Documents

14 Downloads

Preview:

Click to see full reader

DESCRIPTION

Kode Siklik merupakan metode dalam koding

TRANSCRIPT

DETEKSI DAN KOREKSI PADA KODE SIKLIK

Muh. Alfan Taufiqurrahman

7210040013

1. CRC 12

clear all;clc;p=cyclpoly(23,11)[h,g]=cyclgen(23,p);pesan=[0 0 1 0 1 0 0 0 0 1 0]codeword=encode(pesan,23,11,'cyclic')error=zeros(23,1);error(20:22,1)=1code_error=xor(error',codeword)code_noise=fix(code_error)cek=[codeword' code_noise']pesan_terima=decode(code_noise,23,11,'cyclic')cek_pesan=[pesan' pesan_terima']subplot(4,1,1)stem(pesan,'b')title('Pesan Yang Dikirim')subplot(4,1,2)stem(codeword,'g')title('Codeword sebelum ditambah error')subplot(4,1,3)stem(code_noise,'m')title('Codeword dengan 3 bit error')subplot(4,1,4)stem(pesan_terima,'r')Stitle('Pesan Yang Diterima')

p =

1 0 1 0 0 1 0 0 1 1 1 1 1

pesan =

0 0 1 0 1 0 0 0 0 1 0

codeword =

Columns 1 through 15

1 1 1 1 0 1 1 0 0 1 1 1 0 0 1

Columns 16 through 23

0 1 0 0 0 0 1 0error =

0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0

code_error =

Columns 1 through 15

1 1 1 1 0 1 1 0 0 1 1 1 0 0 1

Columns 16 through 23

0 1 0 0 1 1 0 0

code_noise =

Columns 1 through 15

1 1 1 1 0 1 1 0 0 1 1 1 0 0 1

Columns 16 through 23

0 1 0 0 1 1 0 0

cek =

1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1

1 2 3 4 5 6 7 8 9 10 110

0.5

1Pesan Yang Dikirim

0 5 10 15 20 250

0.5

1Codeword sebelum ditambah error

0 5 10 15 20 250

0.5

1Codeword dengan 3 bit error

1 2 3 4 5 6 7 8 9 10 110

0.5

1Pesan Yang Diterima

1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 1 0 1 1 0 0 0pesan_terima =

0 0 1 0 1 0 0 0 0 1 0

cek_pesan =

0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0

2. CRC 16

clear all;clc;p=cyclpoly(36,20)[h,g]=cyclgen(36,p)pesan=[0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0]codeword=encode(pesan,36,20,'cyclic')error=zeros(36,1);error([33:36],1)=1code_error=xor(error',codeword)code_noise=fix(code_error)cek=[codeword' code_noise']pesan_terima=decode(code_noise,36,20,'cyclic')cek_pesan=[pesan' pesan_terima']subplot(4,1,1)stem(pesan,'b')title('Pesan Yang Dikirim')subplot(4,1,2)stem(codeword,'g')title('Codeword sebelum ditambah error')subplot(4,1,3)stem(code_noise,'m') title('Codeword dengan 3 bit error')subplot(4,1,4)stem(pesan_terima,'r')title('Pesan Yang Diterima')

p =

Columns 1 through 12

1 0 0 0 1 0 1 0 0 0 1 0

Columns 13 through 17

1 0 0 0 1

pesan =

Columns 1 through 12

0 1 0 0 1 0 0 0 0 1 0 0

Columns 13 through 20

0 0 0 1 0 0 0 0

codeword =

Columns 1 through 11

1 1 0 0 0 1 1 0 1 0 0

Columns 12 through 22

1 1 0 1 0 0 1 0 0 1 0

Columns 23 through 33

0 0 0 1 0 0 0 0 0 1 0

Columns 34 through 36

0 0 0error =

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1

code_error =

Columns 1 through 11

1 1 0 0 0 1 1 0 1 0 0

Columns 12 through 22

1 1 0 1 0 0 1 0 0 1 0

Columns 23 through 33

0 0 0 1 0 0 0 0 0 1 1

Columns 34 through 36

1 1 1

code_noise =

Columns 1 through 11

1 1 0 0 0 1 1 0 1 0 0

Columns 12 through 22

1 1 0 1 0 0 1 0 0 1 0

Columns 23 through 33

0 0 0 1 0 0 0 0 0 1 1

Columns 34 through 36

1 1 1

cek =

1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0

0 2 4 6 8 10 12 14 16 18 200

0.5

1Pesan Yang Dikirim

0 5 10 15 20 25 30 35 400

0.5

1Codeword sebelum ditambah error

0 5 10 15 20 25 30 35 400

0.5

1Codeword dengan 3 bit error

0 2 4 6 8 10 12 14 16 18 200

0.5

1Pesan Yang Diterima

0 0 0 0 1 1 0 1 0 1 0 1 0 1

Pesan_terima =

Columns 1 through 12

0 1 0 0 1 0 0 0 0 1 0 0

Columns 13 through 20

0 0 0 1 0 0 0 0cek_pesan =

0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0

top related