Anda di halaman 1dari 4

Arisena Argan (7210040021)

DETEKSI DAN KOREKSI PADA KODE SIKLIK


1. CRC 12
clear all;
clc;
p=cyclpoly(28,16)
[h,g]=cyclgen(28,p);
pesan=[0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0]
codeword=encode(pesan,28,16,'cyc
lic')
error=zeros(28,1);
1
error(5:7,1)=1
0.5
code_error=xor(error',codeword)
code_noise=fix(code_error)
0
0
cek=[codeword' code_noise']

Pesan Yang Dikirim

6
8
10
12
Codeword sebelum ditambah error

14

16

0.5
0

10
15
20
Codeword dengan 3 bit error

25

30

10

25

30

1
0.5
0
1

15
20
Pesan Yang Diterima

0.5
0

10

12

14

16

pesan_terima=decode(code_noise,28,16,'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=
1

1 0 0 0
0 0 1

Columns 18 through 28
pesan =
0 0 0
0 0

0
0

codeword =
Columns 1 through 17

0
error =
0
0
0
0
1
1

Arisena Argan (7210040021)


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

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

code_error =

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

Columns 1 through 17
1 0 0 0
0 0 1

Columns 18 through 28
0

pesan_terima =

0
1

0 0 0
0 0

0
cek_pesan =

code_noise =
Columns 1 through 17
1 0 0 0
0 0 1

Columns 18 through 28
0

cek =
1
0
0

1
0
0

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

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

Arisena Argan (7210040021)

2. CRC 16
clear all;
clc;
p=cyclpoly(31,15)
[h,g]=cyclgen(31,p);
pesan=[1 1 0 0 0 0 0 0 0 0 0 0
0 0 0]
codeword=encode(pesan,31,15,'cy
clic')
error=zeros(31,1);
error([8,10],1)=1
code_error=xor(error',codeword)
code_noise=fix(code_error)
cek=[codeword' code_noise']

Pesan Yang Dikirim

1
0.5
0

5
10
Codeword sebelum ditambah error

15

0.5
0

10

10

15
20
25
Codeword dengan 3 bit error

30

35

30

35

0.5
0

15
20
Pesan Yang Diterima

25

0.5
0

pesan_terima=decode(code_noise,31,15,'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=
1 0 0 0
0 1 1 1
pesan =
1 1 0
0 0
codeword =

Columns 1 through 17
0

Columns 18 through 31
1
0
error =
0
0

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

10

15

Arisena Argan (7210040021)


0
0
0
0
0
0
code_error =
Columns 1 through 17
0

Columns 18 through 31
1 0 0
0
code_noise =

Columns 1 through 17
0

0
cek =
0
1
0
0
0
0
0
0
0
1
0

0
1
0
0
0
0
0
1
0
0
0

Columns 18 through 31
1

0 0
0 0
1 1
0 0
1 1
1 1
1 1
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
pesan_terima =

cek_pesan =
0

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

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

Anda mungkin juga menyukai