OFDM信道估计主函数:

% 16QAM modulation, Block-type pilot channel estimation,
% Doppler frequency shift=40Hz
% BER VS SNR
clc;
clear;
close all;
pilot_inter = 5;
cp_length = 16;
rankp = [5,16,20];        % rank SVD-LMMSE
method='QAM16';
method2='Block';
SNR_dB=0:5:40;
fd=40;
BER1 = zeros(1,length(SNR_dB));
BER2 = zeros(1,length(SNR_dB));
BER3 = zeros(1,length(SNR_dB));
BER32 = zeros(1,length(SNR_dB));
BER33 = zeros(1,length(SNR_dB));
for i=1:length(SNR_dB)[BER1(i),BER2(i),BER3(i)]=OFDM(pilot_inter,cp_length,SNR_dB(i),fd,rankp(1),method,method2);
endfor i=1:length(SNR_dB)[BER1(i),BER2(i),BER32(i)]=OFDM(pilot_inter,cp_length,SNR_dB(i),fd,rankp(2),method,method2);
endfor i=1:length(SNR_dB)[BER1(i),BER2(i),BER33(i)]=OFDM(pilot_inter,cp_length,SNR_dB(i),fd,rankp(3),method,method2);
endfigure
% h=axes;
% set(h,'fontsize',25,'fontweight','b')
semilogy(SNR_dB,BER1,'b-o','markerfacecolor','b')
hold on
semilogy(SNR_dB,BER2,'r-s','markerfacecolor','r')
semilogy(SNR_dB,BER3,'g-d','markerfacecolor','g')
semilogy(SNR_dB,BER32,'g->','markerfacecolor','g')
semilogy(SNR_dB,BER33,'g-<','markerfacecolor','g')
grid on
legend('Block-LS','Block-LMMSE',['Block-LMMSE(SVD) rank p=',num2str(rankp(1))],...['Block-LMMSE(SVD) rank p=',num2str(rankp(2))],['Block-LMMSE(SVD) rank p=',num2str(rankp(3))]);
title([method,' ',method2])
xlabel('SNR(dB)')
ylabel('BER(dB)')%%
%16QAM modulation, Comb-type pilot channel estimation
%Doppler frequency shift=80Hz
%BER VS SNR
clear;clc;
pilot_inter=5;
cp_length=16;
rankp=[];
method='QAM16';
method2='Comb';
SNR_dB=0:5:40;
fd=80;for i=1:length(SNR_dB)
[BER1(i),BER2(i),BER3(i)]=OFDM(pilot_inter,cp_length,SNR_dB(i),fd,rankp,method,method2);
end
figure
% h=axes;
% set(h,'fontsize',25,'fontweight','b')
semilogy(SNR_dB,BER1,'r-v','markerfacecolor','r')
hold on
semilogy(SNR_dB,BER2,'b-^','markerfacecolor','b')
semilogy(SNR_dB,BER3,'g-<','markerfacecolor','g')
grid on
h=legend('Comb-LsLinear ','Comb-LsSecondOrder','Comb-LsSpline');
title([method,' ',method2])
xlabel('SNR(dB)')
ylabel('BER(dB)')%%
%16QAM modulation, block-type pilot channel estimation
%SNR=40dB
%BER VS Doppler frequency shift
clc;clear
pilot_inter=5;
cp_length=16;
rankp=5; % rank SVD LMMSE
method='QAM16';
method2='Block';
SNR_dB=40;
fd=20:10:140;for i=1:length(fd)[BER1(i),BER2(i),BER3(i)]=OFDM(pilot_inter,cp_length,SNR_dB,fd(i),rankp,method,method2);
end
% for i=1:length(fd)
%     [BER1(i),BER2(i),BER32(i)]=OFDM(pilot_inter,cp_length,SNR_dB,fd(i),rankp(2),method,method2);
% end
% for i=1:length(fd)
%     [BER1(i),BER2(i),BER33(i)]=OFDM(pilot_inter,cp_length,SNR_dB,fd(i),rankp(3),method,method2);
% endfigure
% h=axes;
% set(h,'fontsize',25,'fontweight','b')
semilogy(fd,BER1,'r-o','markerfacecolor','r')
hold on
semilogy(fd,BER2,'y-d','markerfacecolor','y')
semilogy(fd,BER3,'g-v','markerfacecolor','g')
% semilogy(fd,BER32,'g->','markerfacecolor','g')
% semilogy(fd,BER33,'g-<','markerfacecolor','g')
grid on
legend('Block-LS','Block-LMMSE',['Block-LMMSE(SVD) rank p=',num2str(rankp(1))])
% set(h,'fontsize',20,'fontweight','b')
title([method,' ',method2])
xlabel('Doppler frequency shift(Hz)')
ylabel('BER(dB)')
%%
%QAM16 modulation, comb-type pilot channel estimation
%SNR=40dB
%BER VS Doppler frequency shiftclear;clc;
pilot_inter=5;
cp_length=16;
rankp=[];
method='QAM16';
method2='Comb';
SNR_dB=40;
fd=20:10:140;for i=1:length(fd)
[BER1(i),BER2(i),BER3(i)]=OFDM(pilot_inter,cp_length,SNR_dB,fd(i),rankp,method,method2);
endfigure
% h=axes;
% set(h,'fontsize',25,'fontweight','b')
semilogy(fd,BER1,'b->','markerfacecolor','b')
hold on
semilogy(fd,BER2,'r-<','markerfacecolor','r')
semilogy(fd,BER3,'g-v','markerfacecolor','g')
grid on
h=legend( 'Comb-LsLinear(16QAM) ','Comb-LsSecondOrder(16QAM)','Comb-LsSpline(16QAM)');
% set(h,'fontsize',16,'fontweight','b')
title([method, ' ',method2])
xlabel('Doppler frequency shift(Hz)')
ylabel('BER(dB)')

OFDM子函数

function [BER1,BER2,BER3]=OFDM(pilot_inter,cp_length,SNR_dB,fd,rankp,method,method2)% simulation parameters:
% channel bandwith: 1MHZ
% frequency of carrier fc=1.9GHZ
% number of sub-carrier: 128
% number of OFDM symbols, symbols/carrier: 100
% interval of sub-carrier 7.8125KHZ
% length of cyclic prefix: cp_length
% pilot symbol: pilot_symbol
% number of pilot interval: pilot_inter
% number of multipath: 5
% maximum Doppler frequency shift: fd
% sub-channel time delay: delay=[0 2e-6 4e-6 8e-6 12e-6]
% method: modulation model QAM16 or QPSK
% method2: Block-type pilot or Comb-type pilotofdm_symbol_num=100;               % symbol/carrier, also is number of OFDM symbolsswitch methodcase 'QAM16'pilot_symbol_bit=[0 0 0 1];   % pilot symbolbit_per_carrier=4;            % bit/symbol, for 16QAM is 4bits, while for QPSK is 2bitscase 'QPSK'pilot_symbol_bit=[0 1];       % pilot symbolbit_per_carrier=2;            % bit/symbol, for 16QAM is 4bits, while for QPSK is 2bits
end% for i=1:length(SNR_dB)bit_source = input_b(128,ofdm_symbol_num,bit_per_carrier); % obtain the original binary signal waiting for transmit[nbit,mbit]=size(bit_source);total_bit_num=nbit*mbit;   % the total bit transmitted switch methodcase 'QAM16'map_out = map_16qam(bit_source);         % QAM16 modulationswitch method2case 'Block'[insert_pilot_out,pilot_num,pilot_sequence]=insert_pilot(pilot_inter,pilot_symbol_bit,map_out,'QAM16');%Block-type pilotcase 'Comb'[insert_pilot_out,pilot_num,pilot_sequence]=insert_pilot(pilot_inter,pilot_symbol_bit,map_out','QAM16');%Comb-type pilotinsert_pilot_out=insert_pilot_out';endcase 'QPSK'% QPSK modulation:(1 1)->pi/4;(0 1)->3*pi/4;(0 0)->-3*pi/4;(1,0)->-pi/4;X=reshape(bit_source,1,[]);s=(X.*2-1)/sqrt(2);sreal=s(1:2:length(X));simage=s(2:2:length(X));X1=sreal+1j.*simage;map_out=reshape(X1,128,[]); % QPSK modulationclear X sreal simage X1switch method2case 'Block'[insert_pilot_out,pilot_num,pilot_sequence]=insert_pilot(pilot_inter,pilot_symbol_bit,map_out,'QPSK');%Block-type pilotcase 'Comb'[insert_pilot_out,pilot_num,pilot_sequence]=insert_pilot(pilot_inter,pilot_symbol_bit,map_out','QPSK');%Comb-type pilotinsert_pilot_out=insert_pilot_out';endendofdm_modulation_out=ifft(insert_pilot_out);            % IFFTofdm_cp_out=insert_cp(ofdm_modulation_out,cp_length);  % insert CP%======================fading rayleigh channel===============%suppose the power spectrum follows a negative exponential%distribution: exp(-t/trms), where trms=(1/4)*cp%t is uniformly distributed in [0,cp]num=5;                   % number of sub-channelsdelay=[0 2e-6 4e-6 8e-6 12e-6];trms = 0.25e-6*cp_length;var_pow = 10*log10(exp(-delay/trms));t_interval=1e-6;         % sampling interval 1e-6counter=200000;          % number of samples%     count_begin=(l-1)*(5*counter);%location for begaining the samplingcount_begin=0;trms_1=trms/t_interval;t_max=12e-6/t_interval;% pass the channelpasschan_ofdm_symbol = multipath_chann(ofdm_cp_out,num,var_pow,delay,fd,t_interval,counter,count_begin);% add noisesnr=10^(SNR_dB/10);[nnl,mml]=size(passchan_ofdm_symbol);spow=0;for k=1:nnlfor b=1:mmlspow=spow+real(passchan_ofdm_symbol(k,b))^2+imag(passchan_ofdm_symbol(k,b))^2;endendspow1 = spow/(nnl*mml);sgma = sqrt(spow1/(2*snr));receive_ofdm_symbol = add_noise(sgma,passchan_ofdm_symbol);           % recieved OFDM signalcutcp_ofdm_symbol=cut_cp(receive_ofdm_symbol,cp_length);  % remove CPofdm_demodulation_out=fft(cutcp_ofdm_symbol);             % FFTswitch method2case 'Comb'switch methodcase 'QPSK'bit_source=reshape(s,bit_per_carrier*128,[]);endls_zf_detect_sig_Linear=ls_estimation(ofdm_demodulation_out,pilot_inter,pilot_sequence,pilot_num,method2,'Linear');%LS with linear interpolationls_zf_detect_sig_SecondOrder=ls_estimation(ofdm_demodulation_out,pilot_inter,pilot_sequence,pilot_num,method2,'SecondOrder');%LS with second-Order interpolationls_zf_detect_sig_Spline=ls_estimation(ofdm_demodulation_out,pilot_inter,pilot_sequence,pilot_num,method2,'Spline');%LS with Cubic spline  interpolationls_receive_bit_sig_Linear=de_map(ls_zf_detect_sig_Linear,method);ls_receive_bit_sig_SecondOrder=de_map(ls_zf_detect_sig_SecondOrder,method);ls_receive_bit_sig_Spline=de_map(ls_zf_detect_sig_Spline,method);ls_err_Linear=error_count(bit_source,ls_receive_bit_sig_Linear)/total_bit_num;ls_err_SecondOrder=error_count(bit_source,ls_receive_bit_sig_SecondOrder)/total_bit_num;ls_err_Spline=error_count(bit_source,ls_receive_bit_sig_Spline)/total_bit_num;case 'Block'switch methodcase 'QPSK'bit_source=reshape(s,bit_per_carrier*128,[]);endls_zf_detect_sig_None=ls_estimation(ofdm_demodulation_out,pilot_inter,pilot_sequence,pilot_num,method2,'None');%LSlmmse_zf_detect_sig=lmmse_estimation(map_out,ofdm_demodulation_out,pilot_inter,pilot_sequence,pilot_num,trms_1,t_max,snr);%LMMSlow_rank_lmmse_sig=lr_lmmse_estimation(map_out,ofdm_demodulation_out,pilot_inter,pilot_sequence,pilot_num,trms_1,t_max,snr,rankp);%采用低秩LMMSE估计算法及迫零检测得到的接收信号ls_receive_bit_sig_None=de_map(ls_zf_detect_sig_None,method);lmmse_receive_bit_sig=de_map(lmmse_zf_detect_sig,method);lr_lmmse_receive_bit_sig=de_map(low_rank_lmmse_sig,method);ls_err_None=error_count(bit_source,ls_receive_bit_sig_None)/total_bit_num;lmmse_err=error_count(bit_source,lmmse_receive_bit_sig)/total_bit_num;lr_lmmse_err=error_count(bit_source,lr_lmmse_receive_bit_sig)/total_bit_num;end% endswitch method2case 'Comb'BER1=ls_err_Linear;BER2=ls_err_SecondOrder;BER3=ls_err_Spline;
%         semilogy(SNR_dB,ls_err_Linear,'r-o')
%         hold on
%         semilogy(SNR_dB,ls_err_SecondOrder,'g-d')
%         semilogy(SNR_dB,ls_err_Spline,'b-d')
%
%         grid on
%         legend('LsLinear ','LsSecondOrder','LsSpline')
%         title([method,' ',method2])
%         xlabel('SNR(dB)')
%         ylabel('BER(dB)')
%         case 'Block'BER1=ls_err_None;BER2=lmmse_err;BER3=lr_lmmse_err;%
%         semilogy(SNR_dB,ls_err_None,'b-*')
%         hold on
%         semilogy(SNR_dB,lmmse_err,'r-o')
%         semilogy(SNR_dB,lr_lmmse_err,'g-p')
%         grid on
%         legend('LS','LMMSE','LMMSE(SVD)')
%         title([method,' ',method2])
%         xlabel('SNR(dB)')
%         ylabel('BER(dB)')
end

LMMSE函数

function output=lmmse_estimation(bit_source,input,pilot_inter,pilot_sequence,pilot_num,trms,t_max,snr)temp=reshape(bit_source,1,[]);
beta=mean(abs(temp).^2)*mean((1./abs(temp)).^2);
% beta=17/9;
[N,NL]=size(input);
Rhh=zeros(N,N);
for k=1:Nfor l=1:NRhh(k,l)=(1-exp((-1)*t_max*((1/trms)+1j*2*pi*(k-l)/N)))./(trms*(1-exp((-1)*t_max/trms))*((1/trms)+1j*2*pi*(k-l)/N));end
end
output=zeros(N,NL-pilot_num);
i=1;
count=0;
while i<=NLHi=input(:,i)./pilot_sequence;Hlmmse=Rhh*(Rhh+(beta/snr)\eye(N))*Hi;count=count+1;if  count*pilot_inter<=(NL-pilot_num)for p=((count-1)*pilot_inter+1):count*pilot_interoutput(:,p)=input(:,(i+p-(count-1)*pilot_inter))./Hlmmse;endelsefor p=((count-1)*pilot_inter+1):(NL-pilot_num)output(:,p)=input(:,(i+p-(count-1)*pilot_inter))./Hlmmse;endendi=i+pilot_inter+1;
end
end

LS代码

function output=ls_estimation(input,pilot_inter,pilot_sequence,pilot_num,method2,interpolation)switch method2case 'Block'switch interpolationcase 'None'[N,NL]=size(input);output=zeros(N,NL-pilot_num);i=1;count=0;while i<=NLHi=input(:,i)./pilot_sequence;count=count+1;if  count*pilot_inter<=(NL-pilot_num)for j=((count-1)*pilot_inter+1):count*pilot_interoutput(:,j)=input(:,(i+j-(count-1)*pilot_inter))./Hi;endelsefor j=((count-1)*pilot_inter+1):(NL-pilot_num)output(:,j)=input(:,(i+j-(count-1)*pilot_inter))./Hi;endendi=i+pilot_inter+1;endendcase 'Comb'[N,NL]=size(input);output=zeros(size(input));pilot_local=1:pilot_inter+1:(pilot_num-1)*(pilot_inter+1)+1;  %location of pilotsH=zeros(size(input)); H(pilot_local,:)=input(pilot_local,:)./repmat(pilot_sequence',pilot_num,1); %response in the location of pilotsswitch interpolationcase 'Linear'adjacent=zeros(size(input,1),2);idx=removerows((1:N)',pilot_local);for i=1:length(idx)[~,temp1]=sort(abs(idx(i)-pilot_local));adjacent(idx(i),:)=pilot_local(temp1(1:2));endfor i=1:length(idx)H(idx(i),:)=H(adjacent(idx(i),1),:)+(H(adjacent(idx(i),2),:)-H(adjacent(idx(i),1),:))*(idx(i)-adjacent(idx(i)))/pilot_inter;endoutput=input./H;output=removerows(output, pilot_local);case 'SecondOrder'alfa=1/N;c0=alfa*(alfa-1)/2;c1=-(alfa-1)*(alfa+1);c2=alfa*(alfa+1)/2;adjacent=zeros(size(input,1),3);idx=removerows((1:N)',pilot_local);for i=1:length(idx)[~,temp1]=sort(abs(idx(i)-pilot_local));adjacent(idx(i),:)=pilot_local(temp1(1:3));endfor i=1:length(idx)H(idx(i),:)=c1*H(adjacent(idx(i),1),:)+c0*H(adjacent(idx(i),2),:)+c2*H(adjacent(idx(i),3),:);endoutput=input./H;output=removerows(output, pilot_local);case 'Spline'idx=removerows((1:N)',pilot_local);for j=1:NLH(idx,j)=spline(pilot_local,H(pilot_local,j),idx);endoutput=input./H;output=removerows(output, pilot_local);end
end

SVD-LMMSE

function output=lr_lmmse_estimation(bit_source,input,pilot_inter,pilot_sequence,pilot_num,trms,t_max,snr,cp)temp=reshape(bit_source,1,[]);
beta=mean(abs(temp).^2)*mean((1./abs(temp)).^2);% beta=17/9;
[N,NL]=size(input);
Rhh=zeros(N,N);
for k=1:Nfor l=1:NRhh(k,l)=(1-exp((-1)*t_max*((1/trms)+1j*2*pi*(k-l)/N)))./(trms*(1-exp((-1)*t_max/trms))*((1/trms)+1j*2*pi*(k-l)/N));end
end[U,D]=eig(Rhh);
dlamda=diag(D);
[dlamda_sort,IN]=sort(dlamda);
lamda_sort = zeros(1,N);
IN_new = zeros(1,N);
for k=1:Nlamda_sort(k)=dlamda_sort(N-k+1);IN_new(k)=IN(N-k+1);
end
U_new=zeros(N,N);
for k=1:NU_new(:,k)=U(:,IN_new(k));
enddelta=zeros(N,1);
for k=1:Nif k<=cpdelta(k)=lamda_sort(k)/(lamda_sort(k)+beta/snr);elsedelta(k)=0;end
end
D_new=diag(delta);
output=zeros(N,NL-pilot_num);
i=1;
count=0;
while i<=NLHi=input(:,i)./pilot_sequence;Hlr=U_new*D_new*(U_new')*Hi;count=count+1;if  count*pilot_inter<=(NL-pilot_num)for p=((count-1)*pilot_inter+1):count*pilot_interoutput(:,p)=input(:,(i+p-(count-1)*pilot_inter))./Hlr;endelsefor p=((count-1)*pilot_inter+1):(NL-pilot_num)output(:,p)=input(:,(i+p-(count-1)*pilot_inter))./Hlr;endendi=i+pilot_inter+1;
end
end

信道估计算法matlab代码汇总相关推荐

  1. m基于rbf神经网络和遗传算法优化的MIMO-OFDM系统信道估计算法matlab仿真

    目录 1.算法描述 2.仿真效果预览 3.MATLAB部分代码预览 4.完整MATLAB程序 1.算法描述 MIMO-OFDM的信道估计:时,频,空三个域都要考虑,尤其是在空域,不同天线发射的导频序列 ...

  2. 【信道估计】基于多用户MMSE-BLE算法实现信道估计附matlab代码

    ✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.

  3. 基于子空间的OFDM系统盲信道估计附matlab代码

    ✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.

  4. 【OMP信道估计】基于OMP压缩感知的信道估计算法的MATLAB仿真

    1.软件版本 MATLAB2021a 2.本算法理论知识 3.核心代码 clc; clear; close all; warning off; addpath 'func\'CYC = 20; for ...

  5. m基于RBF神经网络和BP神经网络的信道估计误码率matlab仿真

    目录 1.算法描述 2.仿真效果预览 3.MATLAB核心程序 4.完整MATLAB 1.算法描述 在无线通信系统中,从发射端发射的信号,经过直射.反射.散射等路径到达接收端.在ofdm系统中,为了获 ...

  6. dst matlab,DSTcode DST跟踪算法MATLAB代码,复杂环境中仿多目标 实现的单 Other systems 其他 272万源代码下载- www.pudn.com...

    文件名称: DSTcode下载  收藏√  [ 5  4  3  2  1 ] 开发工具: matlab 文件大小: 82 KB 上传时间: 2017-03-17 下载次数: 0 提 供 者: Mar ...

  7. dijkstra算法matlab代码_头脑风暴优化(BSO)算法(附MATLAB代码)

    BSO讲解https://www.zhihu.com/video/1252605855767736320 B站搜索:随心390,同步观看视频 各位小伙伴可在闲鱼搜索 优化算法交流地,即可搜索到官方闲鱼 ...

  8. AHP算法MATLAB代码

    AHP算法MATLAB代码 使用方法(详情请看这个视频的2P) 数学建模算法之层次分析法详解 代码如下 (1)构造判断矩阵A (2)将下文代码复制粘贴到Matlab中即可 例如: A=[1 3 5;0 ...

  9. 【物理应用】内联全息图外推算法matlab代码

    1 简介 内联全息图外推算法matlab代码 2 部分代码 ​close allclear all% addpath('C:/Program Files/MATLAB/R2010b/myfiles') ...

  10. 大规模MIMO基于EVD的信道估计算法

    大规模MIMO(多输入多输出)基于EVD(特征值分解)的信道估计算法是一种用于估计MIMO系统中信道状态的技术.该算法通过对信道矩阵进行特征值分解,从而获得信道状态.在某些情况下,该算法在信道估计精度 ...

最新文章

  1. [Bat]UNC路径不支持的2种解决方法
  2. 自动化部署之gitlab备份和恢复
  3. SSM框架的简单搭建
  4. spring 事务原理_Spring声明式事务处理的实现原理,来自面试官的穷追拷问
  5. 远控免杀专题(23)-SharpShooter免杀
  6. 关注 Imagine Cup 2010, 参与软件设计“最具人气奖”投票
  7. python打印二进制内容_在python中打印出c类型的二进制表示
  8. mysql union_Mysql union和union all用法
  9. libreoffice使用_使用LibreOffice Calc管理您的财务
  10. 计算机应用类专业综合知识模拟试题,2015年湖南省对口升学计算机应用类专业综合知识试题(真题)...
  11. 浙江科技学院计算机辅助教育试卷,(下册).-浙江科技学院经济与管理学院.doc
  12. 【图像融合】拉普拉斯金字塔融合
  13. 【python实战】使用 pygame 写一个 flappy-bird 类小游戏 | 涉及思路+项目结构+代码详解 | 新手向
  14. 02 linux常用命令
  15. 深入理解linux网络pdf,深入理解Linux网络技术内幕 pdf epub mobi txt 下载
  16. 小瞥linux下UML工具
  17. (附源码)ssm考试题库管理系统 毕业设计 069043
  18. 2265. 统计值等于子树平均值的节点数
  19. Centos下docker相关文件迁移发生的问题记录
  20. 将安卓手机投屏到win10上

热门文章

  1. [Proteus8]使用proteus8对单片机进行模拟仿真,记录方波图出现的过程
  2. Assets文件操作
  3. form表单钩子,局部钩子和全局钩子
  4. Photoshop 2021(Ps)下载安装及详细安装教程
  5. 1分钟恢复损坏的Excel文件
  6. 运动控制系统课程设计
  7. 国二c语言编程题只看结果吗,全国计算机二级C语言上机考试运行和编译都可以,但是运行出的结果和题目要求的结果不一样...
  8. 发布一款小软件:和讯博客助手-测试版- 0.3.0
  9. git文件没有绿色红色小图标
  10. 在Unity3D中控制动画播放