How to match simulation result with theoritical result by adding noise to convolutional encoding with viterbi decoding

matlab code for punctured convolutional encoding and decoding comparing theoritical and simulation results of bit error rate . Simulation results are obatained by adding noise to the coded message. Simulation results should match the theoritical .
First I need to get the simulation results matching with theoritical results. But I am getting the graphs far behind. I need to make the noise parameter awgn to be adjusted to make it equal to theoritical value. And then later add puncturing. And finally make nice GUI.
% (n,k,K)= (2,1,3)
clc;
clear all;
close all;
coderate=1/2;
constlen=3;
codegen= [7 5];
in= randint(10,1)
trellis = poly2trellis(constlen,codegen)
code= convenc(in,trellis) % encoding message
EbNo = [1:1:10]
spect = distspec(trellis,2);
noisy=[]
for n = 1:1:length(EbNo)
EsNo =EbNo(n)
noisy=awgn(code,EsNo)
[x,qcode] = quantiz(noisy,[ 0],[0 1 ])
decoded1 = vitdec(qcode,trellis,1,'trunc','hard') % Decoded message
[num,ratio]=biterr(decoded1',in)
BERVec = ratio
semilogy(EbNo(n),BERVec,'g*'); % Plot point.
hold on;
drawnow
end
decoded= vitdec(code,trellis,1,'trunc','hard')
%[num,ratio]=biterr(decoded,in)
%BER=ratio
spect = distspec(trellis,2);
berbound = bercoding(EbNo,'conv','hard',coderate,spect)
semilogy(EbNo,berbound , '.b'); % Plot the results.
%hold on;
xlabel('E_b/N_0 (dB)'); ylabel('Upper Bound on BER');
title(' BER for Convolutional Coding');
legend('* Simulation results','. theoritical results','location','southwest');
grid on;

6 Comments

Hii.. I need to add noise to the code. to make simulation results matching theoritical results.. I am getting unmatched graphs when I am plotting
Your existing code appears to add noise already, the awgn() calls ?
What difference do you see between what you expect and what you get?
yes I was trying to add noise to make mty theoritical results matching simulation results. But I was getting unmatched graphs. And also in simulation even if EBNo value is incrementing also I was getting higher bit error rate. I need both graphs to be near. I am getting them too far.
I would like to know how to quantiz the noise to get the same decoded output, so that both graphs get matched.

Sign in to comment.

Answers (0)

Categories

Find more on Communications Toolbox in Help Center and File Exchange

Asked:

on 18 Jul 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!