Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

HELP Needed for Matlab simulation for rate 1/3 encoder decod

Status
Not open for further replies.

diggis_tennis

Newbie level 3
Joined
Apr 8, 2009
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
Re: HELP Needed for Matlab simulation for rate 1/3 encoder d

Hi,

I am working on this project where in I have to simulate (matlab, C) a rate 1/3 encoder decoder ( soft or hard) to get minimized gap to capacity over a AWGN channel compared to un coded BPSK. Also I have been given a sample skeleton in which I just need to modify encoder and decoder part else I can write a new program is I want. Can some one please help me here. I know its a simple code but I am a newbie and I have a coding phobia. Thanks. The code can be anything ldpc, convolutional but the performance should be good in terms of the capacity thing. Also he gave a hint to use concatenated Reed solomon with convolutional codes.

Added after 4 minutes:

Here is the skeleton code

L = 1e4; % message length
R = 1/3; % code rate
dbs = -1:10; % SNR per bit, in dB
trials = 1e3; % number of trials to perform

%------------

errs = 0*dbs;
EbN0 = 10.^(dbs/10);
sigs = 1./sqrt(2*R*EbN0);
ber0 = logspace(-6,-2.1,81);
ber1 = logspace(-6,-0.99,81);
db0 = 10*log10((2.^(2*R*(1+log2((ber0.^ber0).*(1-ber0).^(1-ber0))))-1)/(2*R));
db1 = 20*log10(erfinv(1-2*ber1));

for trial = 1:trials,

m = round(rand(1,L)); % message vector

%--------- ENCODER: (3, 1) repetition code --------%
c = reshape([m; m; m],1,3*L);
%--------------------------------------------------%

%verify code rate!
if trial==1,disp(['Measured R = ',num2str(length(m)/length(c))]);end;

noise = randn(1,length(c));
for i=1:length(dbs),
r = 2*c - 1 + sigs(i)*noise;
%--- DECODER: soft (3,1) repetition decoder ---%
mhat = sum(reshape(r,3,L))>0;
%----------------------------------------------%
errs(i) = errs(i) + sum(mhat ~= m);
end;

ber = errs/(L*trial);
semilogy(dbs, ber,'o-', db0, ber0,':', db1, ber1,':');
xlabel('SNR per bit, E_b / N_0 (dB)');
ylabel('Bit-Error Rate');
axis([-1 10 1e-6 1])
title(['After ',num2str(trial),' trials (',num2str(L*trial),' msg bits)']);
drawnow;

end;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top