function [D,x,d_bp,d_pc]=Duobinary_EncDec(d)
% Precoded Duobinary coder and decoder
% d = Binary data sequence : precoder input
% c = duobinary coder output
% b_r = duobinary decoder output
N = length(d);
d_pc(1) = 0; % Initialized
for n=2:N
d_pc(n) = mod(-d_pc(n-1)+d(n),2); % Precoding by Eq.(6.1.21)
end
d_bp = 2*d_pc - 1; % Bipolarization
for n=2:N
x(n) = d_bp(n-1)+d_bp(n); % Duobinary coding by Eq.(6.1.23)
end
% Make a received signal with one error at a random position
r = x; ne = randi([3 N]);
if x(ne)==0, r(ne)=2; else r(ne)=0; end
% Duobinary decoder output
D = mod(round(r/2)+1,2); % Duobinary decoding by Eq.(6.1.25)
[d(2:end); D(2:end)] % Transmitted binary sequence and the decoding result at receiver
% Usage
%b=[1 1 1 0 0 1 0 1 0 0 0];
%D=Duobinary_EncDec(b);
Comment only
27 Dec 2014
MATLAB for Digital Communication
The MATLAB programs in "MATLAB/Simulink for Digital Communication" authored by Won Y. Yang et. al
I want Matlab code for Duobinary Encoding and Decoding?
or atleast modify this code. Please sir its urgent
CODE:
function [c,b_r]=Duobinary_EncDec(b)
% Precoded Duobinary coder and decoder
% b = input binary sequence:precoder input
% c = duobinary coder output
%b_r = duobinary decoder output
a(1) = xor(1,b(1));
if(a(1)==1)
a_volts(1) = 1;
end
for k =2:length(b)
a(k) = xor(a(k-1),b(k));
if(a(k)==1)
a_volts(k)=1;
else
a_volts(k)=-1;
end
end
a = a';
a_volts = a_volts';
disp(a,'Precoder output in binary form:')
disp(a_volts,'Precoder output in volts:')
% Duobinary coder output in volts
c(1) = 1+ a_volts(1);
for k =2:length(a)
c(k) = a_volts(k-1)+a_volts(k);
end
c = c';
disp(c,'Duobinary coder output in volts:')
% Duobinary decoder output by applying decision rule
for k =1:length(c)
if(abs(c(k))>1)
b_r(k) = 0;
else
b_r(k) = 1;
end
end
b_r = b_r';
disp(b_r,'Recovered original sequence at detector oupupt:')
endfunction
Hai this s really awesome work... can I have the detailed documentation .. to understand the entire system ... mail me at karthimak099@gmail.com .. thanks in advance.
5
10 Dec 2014
MATLAB for Digital Communication
The MATLAB programs in "MATLAB/Simulink for Digital Communication" authored by Won Y. Yang et. al
Comment only