【Turbo】基于MATLAB的turbo编译码算法的仿真
1.软件版本
MATLAB2021a
2.核心代码
%% Turbo Code
% Encoder: RSC (Recursive Systematic Convolution)
% Decoder: BCJR iterative decoder%% Parameter declaration
close all;clear all;clc;
N=1e4; %Block length
X=floor(2*rand(1,N)); %Information bit generation
Interleaver=randperm(N); %Interleaver(random permutation of first N integers)
SNRdB=0:0.5:9; %SNR in dB
SNR=10.^(SNRdB/10); %SNR in linear scale
Iteration=4;
ber=zeros(length(SNR),Iteration); %Simulated BER(Each column corresponds to one iteration)
%% Encoding
X_pi(1:N)=X(Interleaver(1:N)); %Interleaving input bits for RSC-1 encoderC0=zeros(1,N); %Code Bit for encoder RSC-0
C1=zeros(1,N); %Code Bit for encoder RSC-1
for i=1:Nk = i;while (k >= 1)C0(i) = xor ( C0(i),X(k) );C1(i) = xor ( C1(i),X_pi(k) );k=k-2;end
end
P0 = xor (X,[0,C0(1:end-1)]);
P1 = xor (X_pi,[0,C1(1:end-1)]);Input_matrix=2*[0,1;0,1;0,1;0,1]-1; %First column represents input=0 and second column represents input=1
%Each row represents state 00,10,01 and 11 respectively
Parity_bit_matrix=2*[0,1;1,0;0,1;1,0]-1; %Parity bits corresponding to inputs of above matrixmod_code_bit0=2*X-1; %Modulating Code Bits using BPSK Modulation
mod_code_bit1=2*P0-1;
mod_code_bit2=2*P1-1;
fprintf('Encoding completed...\n');%% Decoding
for k=1:length(SNR) %Simulation starts hereR0=sqrt(SNR(k))*mod_code_bit0+randn(1,N); % Received Codebits Corresponding to input bitsR1=sqrt(SNR(k))*mod_code_bit1+randn(1,N); % Received Codebits Corresponding to parity bits of RSC-0R2=sqrt(SNR(k))*mod_code_bit2+randn(1,N); % Received Codebits Corresponding to parity bits of RSC-1R0_pi(1:N)=R0(Interleaver(1:N)); %Interleaving received codebits corresponding to input bits to be used by RSC-1BCJR=0; %First iteration will be done by BCJR-0Apriori=ones(2,N); %First row for prob. of i/p 0 and second row for prob. of i/p 1Apriori=Apriori*0.5; %Initializing all apriori to 1/2for iter=1:Iteration %Iterative process starts hereif BCJR==0 %If BCJR is 0 then pass R0 and R1 to calculate GAMMAGAMMA=gamma_1(Apriori,N,Input_matrix,Parity_bit_matrix,R0,R1,SNR(k));else %If BCJR is 1 then pass R0_pi and R2 to calculate GAMMAGAMMA=gamma_1(Apriori,N,Input_matrix,Parity_bit_matrix,R0_pi,R2,SNR(k));endALPHA=alpha_1(GAMMA,N); %Calculation of ALPHA at each stage using GAMMA and ALPHA of previous stageBETA=beta_1(GAMMA,N); %Calculation of BETA at each stage using GAMMA and BETA of next stage%Calculating LAPPR using ALPHA,BETA and GAMMA[~,~,LAPPR_1]=lappr(ALPHA,BETA,GAMMA,N);decoded_bits=zeros(1,N);decoded_bits(LAPPR_1>0)=1; %Decoding is done using LAPPR valuesif BCJR==0 %If the decoder is BCJR-0 thenber(k,iter)=sum(abs((decoded_bits-X))); %calculate BER using input Xlappr_2(1:N)=LAPPR_1(Interleaver(1:N)); %Interleave the LAPPR values and pass to BCJR-1else %If the decoder is BCJR-1 thenber(k,iter)=sum(abs((decoded_bits-X_pi))); %calculate BER using input X_pilappr_2(Interleaver(1:N))=LAPPR_1(1:N); %Re-interleave the LAPPR values and pass to BCJR-0endLAPPR_1=lappr_2;ber(ber==1)=0; %Ignoring 1 bit errorApriori(1,1:N)=1./(1+exp(LAPPR_1)); %Apriori corresponding to input 0Apriori(2,1:N)=exp(LAPPR_1)./(1+exp(LAPPR_1)); %Apriori corresponding to input 1BCJR=~BCJR; %Changing the state of the decoder for the next iterationend %One iteration ends hereu = k/length(SNR) * 100;string = [num2str(round(u)) , '% decoding completed ...'];disp(string);
end
ber=ber/N;
figure;
%% Plots for simulated BER
semilogy(SNRdB,ber(:,1),'k--','linewidth',2.0);
hold on
semilogy(SNRdB,ber(:,2),'m-o','linewidth',2.0);
hold on
semilogy(SNRdB,ber(:,3),'b-<','linewidth',2.0);
hold on
semilogy(SNRdB,ber(:,4),'r-<','linewidth',2.0);
%% Theoretical expression for BER for corresponding convolution code
BER=zeros(1,length(SNR));
for j=1:10BER=BER+(2^j)*(j)*qfunc(sqrt((j+4)*SNR));
end
semilogy(SNRdB,BER,'c-','linewidth',2.0)
title('Turbo decoder performance over AWGN channel for BPSK modulated symbols');
xlabel('SNR(dB)');ylabel('BER');
legend('1st Iteration','2nd Iteration','3rd Iteration','4th Iteration','Theoretical Bound');
grid on
axis tight
3.操作步骤与仿真结论
4.参考文献
[1] Berrou C . Near Shannon limit error-correcting coding and decoding : Turbo-codes[J]. Proc. ICC93, 1993.
D219
5.完整源码获得方式
方式1:微信或者QQ联系博主
方式2:订阅MATLAB/FPGA教程,免费获得教程案例以及任意2份完整源码
【Turbo】基于MATLAB的turbo编译码算法的仿真相关推荐
- 基于matlab的BCH编译码算法原理介绍与仿真分析
1.问题描述: BCH码的译码可以分为时域译码和频域译码两种. 频域译码是把码字看作一个时域数字序列,对其进行有限域的离散傅氏变换(DFT)将它变换到频域,然后利用其频域特点译码.这样通过对频域伴随式 ...
- 基于matlab的卷积码实验报告,基于MATLAB的卷积码编译码设计仿真.doc
摘要:在数字信号的传输过程中,会受到信道特性不理想和噪声的影响,通常采用差错控制编码来提高系统的可靠性.卷积码是P.Elias等人提出的,这一编码技术至今广泛使用.目前,卷积码已普遍在无线通信标准使用 ...
- 基于matlab的LDPC编译码误码率仿真,调制方式为64QAM
目录 1.算法概述 2.仿真效果 3.MATLAB仿真源码 1.算法概述 "LDPC编译码 低密度校验码(LDPC码)是一种前向纠错码,LDPC码最早在20世纪60年代由Gallager在他 ...
- 基于MATLAB的LDPC编译码误码率仿真,仿真调制为64QAM,对比不同译码迭代次数
目录 1.算法描述 2.仿真效果预览 3.MATLAB核心程序 4.完整MATLAB 1.算法描述 LDPC码是麻省理工学院Robert Gallager于1963年在博士论文中提出的一种具有稀疏校验 ...
- 基于matlab的RS编译码仿真,从底层原理分析RS编译码的实现过程
欢迎订阅<FPGA学习入门100例教程>.<MATLAB学习入门100例教程> 目录 一.理论基础 二.核心程序 三.测试结果 一.理论基础
- 基于MATLAB的LDPC编译码仿真,调制为64QAM
部分源码: % 首先加载G , H clear all load G.mat; load H.mat; max_iter=50; L_frame=size(G,1); n_frame=100; sta ...
- 【PSO运输优化】基于MATLAB的PSO运输优化算法的仿真
1.软件版本 matlab2013b 2.本算法理论知识 问题是,假设我有一个收集轨道,上面有5个采集堆,这5个采集堆分别被看作一个4*20的矩阵(下面只有4*10),每个模块(比如:A31和A32的 ...
- 【MATLAB教程案例31】基于matlab的人脸检测相关算法的仿真与分析——肤色模型与形态学图像处理方法
FPGA教程目录 MATLAB教程目录 目录 1.软件版本 2.人脸检测理论概述 3.人脸检测的matlab实现
- 基于64QAM调制解调的LDPC编译码算法误码率matlab仿真
目录 1.算法描述 2.仿真效果预览 3.MATLAB核心程序 4.完整MATLAB 1.算法描述 LDPC译码从译码算法的实现角度可以将译码类型分为硬判决译码和软判决译码两种类型.其中,硬判决译码方 ...
- matlab 卷积码函数,MATLAB实现卷积码编译码-.doc
MATLAB实现卷积码编译码- 本科生毕业论文(设计) 题 目: 作者姓名: 学 号: 单 位: 指导教师: 年 月 日 目 录 前言1 1. 纠错码基本理论2 1.1纠错码基本理论2 1.1.1纠错 ...
最新文章
- 将NetBIOS名称解析为IP地址的常用方法
- webstorm 修改端口号
- php千人千面框架,千人千面的设计才是最好设计!安卓 UI 可以如此自由
- How to hide index.php on nginx
- ubuntu安装QT4的方法
- 可变参数模板、右值引用带来的移动语义完美转发、lambda表达式的理解
- 解决自建ca认证后浏览器警告
- cake php_如何(以及为什么)在Swinject中使用Cake Pattern
- 如何重新安装 Linux 的操作管理套件 (OMS) 代理
- C语言,功能一、利用一维数组和选择法对成绩高低排序,功能二、输出对应的学号,功能三、查找对应学生成绩
- [2019徐州网络赛J题]Random Access Iterator
- 百度实习1,2,3面-教育知心搜索前端项目组
- execute()方法
- [dsu on tree] Codeforces #741D. Arpa's letter-marked tree and Mehrdad's Dokhtar-kosh paths
- 计算机word正文样式怎么新建,Word怎么给格式和样式设定快捷键
- python爬取百度街景图像
- IE8开发者工具 有打开却看不见
- 再更新:2022 京东/淘宝双11活动一键自动完成任务脚本app来了,顺便说个事情...
- 后渗透之关闭防火墙、杀毒软件并开启远程桌面
- 二叉树 | 二叉树的深度