各位大佬,在此請教一個問題:
我做了一個基于Wu Yufei代碼的Turbo編譯碼程式,想仿真在Rayleigh信道中的誤碼率。采用了Matlab 2009中的Rayleighchan函式和awgn函式。
但是譯碼之后,誤碼率為10^0,麻煩各位幫我看看
代碼如下:
en_output = encoderm( x, g, alpha, puncture ) ; % Turbo譯碼器,做了BPSK調制encoder output (1->+1,0->-1)
chan = rayleighchan; %Rayleigh Channel,暫不考慮多普勒頻移
r_chan = filter(chan,en_output); %Effect Channel
yk = demultiplex(r_chan,alpha,puncture); % demultiplex to get input for decoder 1 and 2
% Scale the received bits
rec_s = 0.5*L_c*yk;
% Initialize extrinsic information
% L_e(1:L_total) = zeros(1,L_total);
L_e = zeros(1,L_total);
for iter = 1:niter
% Decoder one
L_a(alpha) = L_e; % a priori info.
L_all = logmapo(rec_s(1,:), g, L_a, 1); % complete info.
L_e = L_all - 2*rec_s(1,1:2:2*L_total) - L_a; % extrinsic info.
% Decoder two
L_a = L_e(alpha); % a priori info.
L_all = logmapo(rec_s(2,:), g, L_a, 2); % complete info.
L_e = L_all - 2*rec_s(2,1:2:2*L_total) - L_a; % extrinsic info.
% Estimate the info. bits
xhat(alpha) = (sign(L_all)+1)/2;
% Number of bit errors in current iteration
err(iter) = length(find(xhat(1:L_total-m)~=x));
% Count frame errors for the current iteration
if err(iter)>0
nferr(nEN,iter) = nferr(nEN,iter)+1;
end
end
%iter
% Total number of bit errors for all iterations
errs(nEN,1:niter) = errs(nEN,1:niter) + err(1:niter);
if rem(nframe,3)==0 || nferr(nEN, niter)==ferrlim
% Bit error rate
ber(nEN,1:niter) = errs(nEN,1:niter)/nframe/(L_total-m);
% Frame error rate
fer(nEN,1:niter) = nferr(nEN,1:niter)/nframe;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/64548.html
標籤:C語言
上一篇:VC6.0編譯問題
下一篇:在線求助倒數三題,
