0% found this document useful (0 votes)
72 views3 pages

Tugas Matlab Pengkodean Kanal (El-5054) : Oleh

This document discusses implementing an encoder and decoder in MATLAB for a coding channel assignment. It presents two methods for the encoder - using the built-in poly2trellis function and creating a custom function. It also presents two methods for the decoder - using the built-in vitdec function and creating a custom function. The results show that using the built-in poly2trellis function achieves a minimum BER of 0.0013 and maximum of 0.1228. Creating a custom encoder function produces errors, with BER values far from those using the built-in poly2trellis function.

Uploaded by

nivika tiffany
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views3 pages

Tugas Matlab Pengkodean Kanal (El-5054) : Oleh

This document discusses implementing an encoder and decoder in MATLAB for a coding channel assignment. It presents two methods for the encoder - using the built-in poly2trellis function and creating a custom function. It also presents two methods for the decoder - using the built-in vitdec function and creating a custom function. The results show that using the built-in poly2trellis function achieves a minimum BER of 0.0013 and maximum of 0.1228. Creating a custom encoder function produces errors, with BER values far from those using the built-in poly2trellis function.

Uploaded by

nivika tiffany
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

TUGAS MATLAB

PENGKODEAN KANAL (EL-5054)

Oleh :
Ryan Alfian

23215306

PROGRAM STUDI TEKNIK ELEKTRO


SEKOLAH TEKNIK ELEKTRO DAN INFORMATIKA
INSTITUT TEKNOLOGI BANDUNG
2017
2

SOAL
Implementasikan Encoder dan decoder pada matlab :
A. Encoder
1. dengan fungsi bawaan poly2trellis.m
2. dengan fungsi bawaan sendiri
B. Decoder
1. dengan fungsi bawaan vitdec.m
2. dengan fungsi bawaan sendiri

Penyelesaian :
A. Encoder
1. menggunakan fungsi bawaan Poly2trellis.m

Analisa : dari hasil perhitungan dengan menggunakan fungsi bawaan, didapatkan nilai BER
minimum sebesar 0.0013 dan BER maksimum sebesar 0.1228
Code matlab :
clear all;close all; clc;
% probability bit error BSC
pb_bsc = [10^-1 10^-2];
monte_carlo = 50;

for m = 1:monte_carlo
for j = 1:length(pb_bsc)
[BER_UN(j) BER(j)] = task1(pb_bsc(j));
end
av_BER(m,:) = BER;
av_BER_no_e(m,:) = BER_UN;
end
biterr = mean(av_BER);

TUGAS PENGKODEAN KANAL (EL-5054)


3

biterr_no_e = mean(av_BER_no_e);

loglog(pb_bsc,biterr); hold on;


loglog(pb_bsc,biterr_no_e); hold off;
title('Convolutional Code')
ylabel('BER');xlabel('Probability bit error BSC');
legend('Encoded Hard Decision','Without Encoding','Location','Southeast');

2. menggunakan fungsi sendiri


%% Ryan Alfian/23215306

function [BER] = task1(pb)

%% Encoder
N_data = 1e5; % Number of input data bits
g1 = str2num(dec2base(bin2dec('1111'),8)); % Generator Polynomial path 1
g2 = str2num(dec2base(bin2dec('1101'),8)); % Generator Polynomial path 2
constrainL = 3; % Constaint Length
trellis = poly2trellis(constrainL,[g1 g2]); % Build trellis
% data = [1 0 1 1 1]
data = randi([0 1],1,N_data); % Create binary input data sequence
coded = convenc(data,trellis); % Encode input data

%% Binary Symmetric Channel (BSC)


% pb = 10^-2;
bsc_coded = comm.BinarySymmetricChannel('ErrorProbability',pb); % create
channel
[noisyData, err] = step(bsc_coded, coded); % Pass data through channel
% noisyData : data with error
% err : data error position
ber_ch = sum(err)/length(coded); % BER send coded data vs noisy data

%% Decoding (Hard Decision)


decoded = vitdec(noisyData,trellis,2,'trunc','hard');
BER = sum(xor(data,decoded))/N_data; % BER original data vd decoded data
[ber_ch BER]
end

Analisa : dengan menggunakan fungsi sendiri, maka masih didapatkan kesalahan/error


dimana nilai BER jauh dari no A 1.

TUGAS PENGKODEAN KANAL (EL-5054)

You might also like