How to calculate soft output for bpsk demodulator
2 views (last 30 days)
Show older comments
I use BPSK modulator and de-modulator and for error correction i use LDPC. input for LDPC decoder should be soft out put (likelihood) not real value but to calculate this soft bit I have problem. below is my code, how to calculate the soft bit out put according to my BPSK modulation?
SNR=[-1 :1 ];
msgLength=1000;
for i=1:length(SNR)
Nerr_ch(i) = 0;
Nerr(i)=0;
% Make random data (0/1)
BitIn = round(rand(msgLength,1));
% Encoding
% in this part I use LDPC Encoding function
BitEncode = BitIn;
% BPSK modulation 0 -> -1; 1 -> 1
bpskMod = 2*BitEncode - 1;
sigma=10^(-SNR(i)/20);
N0=1/sqrt(2)*(randn(msgLength,1)+1i*randn(msgLength,1));
noise=sigma *N0 ;
% Add noise
rx = bpskMod+noise;
% BPSK Demodulation
*% in this line I have problem I suppose to multiple sigma and -1 to rx signal
% receiver - Soft decision decoding
Bitout_soft=-1*rx*sigma;*
% receiver - Hard decision decoding
BitOut=real(rx)>0;
%Decoding
BitDecode=Bitout_soft;
% Channel errors
[num1, rat1] = biterr(BitOut, BitEncode);
Nerr_ch(i) = (Nerr_ch(i) + rat1);
% Count errors of LDPC function
[num2, rat2] = biterr(BitDecode, BitIn);
Nerr(i) = (Nerr(i) + rat2);
end
0 Comments
Answers (0)
See Also
Categories
Find more on BPSK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!