How to match simulation result with theoritical result by adding noise to convolutional encoding with viterbi decoding
Show older comments
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
Walter Roberson
on 19 Jul 2012
You missed asking a question ?
amrutha
on 23 Jul 2012
Walter Roberson
on 23 Jul 2012
Your existing code appears to add noise already, the awgn() calls ?
What difference do you see between what you expect and what you get?
amrutha
on 23 Jul 2012
amrutha
on 23 Jul 2012
amrutha
on 23 Jul 2012
Answers (0)
Categories
Find more on Communications Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!