matido
Junior Member level 1
Dear sir ,
I am trying to create a matlab model of HARQ ( all types) using LDPC (llr based) as fec .
I wrote a code using matlab library (fec.ldpcenc-fec.ldpcdec) , but the BER curve is somehow different than the other literature works .
Could you explain me what is wrong with my approach ,did i miss something (maybe sigma calculations?) ?
here are some literature BER (2nd is FER) graphs(DVB-S2 ldpc):
my BER curves (Eb/No-BER) :
for R=1/3,max.iter =50
for R=1/3 ,max.iter.=30
for R=1/2 , max.iter.=50
My matlab code :
R=1/2;
t_er=zeros(1,21);
er=zeros(1,21);
SNRdB=-1:0.20:3;
trial=70;
enc = fec.ldpcenc; % Construct a default LDPC encoder object
dec = fec.ldpcdec; % Construct a companion LDPC decoder object
dec.DecisionType = 'Hard decision'; % Set decision type
dec.OutputFormat = 'Information part'; % Set output format
dec.NumIterations = 50; % Set number of iterations
dec.DoParityChecks = 'Yes'; % Stop if all parity-checks are satisfied
for z=1:21 %z=1:length(SNRdB)
for run=1:trial
msg = randi([0 1],1,enc.NumInfoBits); % random binary message
codeword = encode(enc,msg); % Encode the message
% Construct a BPSK modulator object
modObj = modem.pskmod('M',2,'InputType','Bit');
% Modulate the signal (map bit 0 to 1 + 0i, bit 1 to -1 + 0i)
modulatedsig = modulate(modObj, codeword);
SNR(z)=10^(SNRdB(z)/10);
ebno_c(z)=SNR(z)*R;%Eb/No for coded signal!!!!!!!!!!!!!!<----!
% Noise parameters
var(z) = 1 / (2 * ebno_c(z));%No/2 !!!!!!!!!!!!!!!
%or-->sigma = sqrt((10^(-SNRdB(z)/10))/(2*R));
% Transmit signal through AWGN channel
receivedsig = modulatedsig+sqrt(var(z)).*randn(1,enc.blocklength);
%or-->receivedsig = modulatedsig+sigma.*randn(1,enc.blocklength);
% Construct a BPSK demodulator object to compute log-likelihood ratios
demodObj = modem.pskdemod(modObj,'DecisionType','LLR','NoiseVariance',var(z));
%or-->demodObj = modem.pskdemod(modObj,'DecisionType','LLR','NoiseVariance',sigma^2);
% Compute log-likelihood ratios (AWGN channel)
llr = demodulate(demodObj, receivedsig);
% Decode received signal
decodedmsg = decode(dec, llr);
% Actual number of iterations executed
iter = ...
num2str(dec.ActualNumIterations);
% Number of parity-checks violated
parity_checks_violated = num2str(sum(dec.FinalParityChecks));
% Compare with original message
er(z) = (nnz(decodedmsg-msg));
t_er(z)=t_er(z)+er(z);
end
av_er(z)=t_er(z)/trial;
ber(z)=av_er(z)/32400; %for R=1/3-->ber(z)=av_er(z)/21600;
end
semilogy(SNRdB,ber,'--rs','LineWidth',2,'MarkerEdgeColor','r')
Could you help me to get LDPC(DVB-S2) Eb/No-BER by using matlab library functions??
THANK YOU IN ADVANCE
I am trying to create a matlab model of HARQ ( all types) using LDPC (llr based) as fec .
I wrote a code using matlab library (fec.ldpcenc-fec.ldpcdec) , but the BER curve is somehow different than the other literature works .
Could you explain me what is wrong with my approach ,did i miss something (maybe sigma calculations?) ?
here are some literature BER (2nd is FER) graphs(DVB-S2 ldpc):
my BER curves (Eb/No-BER) :
for R=1/3,max.iter =50
for R=1/3 ,max.iter.=30
for R=1/2 , max.iter.=50
My matlab code :
R=1/2;
t_er=zeros(1,21);
er=zeros(1,21);
SNRdB=-1:0.20:3;
trial=70;
enc = fec.ldpcenc; % Construct a default LDPC encoder object
dec = fec.ldpcdec; % Construct a companion LDPC decoder object
dec.DecisionType = 'Hard decision'; % Set decision type
dec.OutputFormat = 'Information part'; % Set output format
dec.NumIterations = 50; % Set number of iterations
dec.DoParityChecks = 'Yes'; % Stop if all parity-checks are satisfied
for z=1:21 %z=1:length(SNRdB)
for run=1:trial
msg = randi([0 1],1,enc.NumInfoBits); % random binary message
codeword = encode(enc,msg); % Encode the message
% Construct a BPSK modulator object
modObj = modem.pskmod('M',2,'InputType','Bit');
% Modulate the signal (map bit 0 to 1 + 0i, bit 1 to -1 + 0i)
modulatedsig = modulate(modObj, codeword);
SNR(z)=10^(SNRdB(z)/10);
ebno_c(z)=SNR(z)*R;%Eb/No for coded signal!!!!!!!!!!!!!!<----!
% Noise parameters
var(z) = 1 / (2 * ebno_c(z));%No/2 !!!!!!!!!!!!!!!
%or-->sigma = sqrt((10^(-SNRdB(z)/10))/(2*R));
% Transmit signal through AWGN channel
receivedsig = modulatedsig+sqrt(var(z)).*randn(1,enc.blocklength);
%or-->receivedsig = modulatedsig+sigma.*randn(1,enc.blocklength);
% Construct a BPSK demodulator object to compute log-likelihood ratios
demodObj = modem.pskdemod(modObj,'DecisionType','LLR','NoiseVariance',var(z));
%or-->demodObj = modem.pskdemod(modObj,'DecisionType','LLR','NoiseVariance',sigma^2);
% Compute log-likelihood ratios (AWGN channel)
llr = demodulate(demodObj, receivedsig);
% Decode received signal
decodedmsg = decode(dec, llr);
% Actual number of iterations executed
iter = ...
num2str(dec.ActualNumIterations);
% Number of parity-checks violated
parity_checks_violated = num2str(sum(dec.FinalParityChecks));
% Compare with original message
er(z) = (nnz(decodedmsg-msg));
t_er(z)=t_er(z)+er(z);
end
av_er(z)=t_er(z)/trial;
ber(z)=av_er(z)/32400; %for R=1/3-->ber(z)=av_er(z)/21600;
end
semilogy(SNRdB,ber,'--rs','LineWidth',2,'MarkerEdgeColor','r')
Could you help me to get LDPC(DVB-S2) Eb/No-BER by using matlab library functions??
THANK YOU IN ADVANCE