• 欢迎光临~

matlab2017b

# 2.本算法理论知识

《LMMSE turbo equalization based on factor graphs》

# 3.部分源码

clc;
clear all;
close all;
warning off;
rng(1)
N = 512*50;%指定信号序列长度?
info = [ones(1,2048),func_random_binary(N)];%产生二进制信号序列
SNR_in_dB = [1,5,7];%AWGN信道信噪比
%交织512
[Interleaver,De_Interleaver] = func_interleaver();
info4 = [];
for j=1:length(SNR_in_dB)
j
%通过既有码间干扰又有白噪声信道
%Encoder
%82954,76810=6144，数据长度的对齐，方便后面误码率的计算
turbo_code = [func_turbo_encode_map(logical((info+1)/2)),zeros(1,9207)];
info2 = [];
%交织过程
for ii = 1:length(turbo_code)/length(Interleaver)
tmps1 = turbo_code(length(Interleaver)*(ii-1)+1:length(Interleaver)*ii);
info2 = [info2,tmps1(Interleaver)];
end

%通过信道
[y,len,h] = func_channel(2*info2-1,SNR_in_dB(j));

%LMMSE均衡
if j == 1
info4 = zeros(size(info));
end
z = func_LMMSE_eq(y,h,SNR_in_dB(j),info4);
info4 = [];
decis = [2*[z>=0]-1]';
%选择LMMSE之后有效的部分进行turbo的decode
%XX = [decis(6:82953+5)];
XX = [decis(6:83456+5)];
%解交织
info3 = [];
for ii = 1:length(XX)/length(De_Interleaver)
tmps2 = XX(length(De_Interleaver)*(ii-1)+1:length(De_Interleaver)*ii);
info3 = [info3,tmps2(De_Interleaver)];%交织
end
%demap_decode
output= 2*func_turbo_decode_demap(info3(1:82953))-1;%82953

% %进行反馈，给LMMSE
% %交织过程
% for ii = 1:length(output)/length(Interleaver)
% tmps = output(length(Interleaver)*(ii-1)+1:length(Interleaver)*ii);
% info4 = [info4,tmps(Interleaver)];
% end
% %map
% info4 = 2*info4-1;
%初始误码统计数
NumErr1 = sum(info(1:27499)~=output(1:27499));
Pe4(j) = NumErr1/N;
end;
figure;
semilogy(SNR_in_dB,Pe4,'m->','linewidth',2);
grid on
xlabel('SNR(dB)');
ylabel('error');
save R.mat SNR_in_dB Pe4

# 5.参考文献

[1] Guo Q , Li P . LMMSE turbo equalization based on factor graphs[J]. Selected Areas in Communications, IEEE Journal on, 2008, 26(2):311-319.A01-142