You are on page 1of 1

% PEMODELAN DAN SIMULASI

%
QPSK CYCLIC
m = 2; n = 2^m-1; % = 3
k = 2;
% ENCODER 100 messages, k bits each.
msg1 = randi([0,1],100*k,1); % As a column vector
msg2 = vec2mat(msg1,k); % As a k-column matrix
msg3 = bi2de(msg2)'; % As a row vector of decimal integers
% ENCODER 100 codewords, n bits each.
code1 = encode(msg1,n,k,'cyclic/binary');
code2 = encode(msg2,n,k,'cyclic/binary');
code3 = encode(msg3,n,k,'cyclic/decimal');
% MODULATORNahiniQPSK
Modulator = comm.PSKModulator(4,'BitInput',true);
modData = step(Modulator, code1); % Modulasi
% RAYLEIGH FADING
fading = rayleighchan(1/10000,100);
fadsignal = filter(fading,modData); % Fading Rayleigh
% AWGN
hChan = comm.AWGNChannel('EbNo',4, ...
'BitsPerSymbol', log2(Modulator.ModulationOrder));
AWGN = step (hChan, fadsignal); % AWGN
% DEMODULATOR
Demodulator = comm.PSKDemodulator(4, 'BitOutput',true);
demodData = step(Demodulator, AWGN); % Demodulasi
% DECODER
cyclicdecoder = decode(demodData,n,k,'cyclic/binary');

You might also like