⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 channel_esti_em730a.m

📁 ofdm_EM_channel OFDM信道估计源代码
💻 M
字号:
%使用静态的sigma
function [channel_we_esti,kh] = channel_esti_em(rec_tempo_Signal,Dist,pilotNUM,sigma0);%on_off表示是否加了导频
  tmp = size(rec_tempo_Signal);
  Xtmp=[1+i;1-i;-1+i;-1-i]./sqrt(2);
  kh=zeros(1,tmp(2)-pilotNUM);
  khi=0;
  
  sigma=sigma0*ones(4,tmp(1));%方差
  miu=0*ones(4,tmp(1));
  for k=1:pilotNUM
      channel_we_esti(:,Dist*(k-1)+k)=rec_tempo_Signal(:,Dist*(k-1)+k)./ones(tmp(1),1);%第一列由导频估计的信道
  for n=Dist*(k-1)+k+1:Dist*(k-1)+k+1+Dist-1
       yyi=rec_tempo_Signal(:,n);
      YYtmp=repmat(yyi',4,1);%复制四份以对应四个点
      Htmp=channel_we_esti(:,n-1)';%用于估计的上一列信道
      %for m=1:6
      
      khi=khi+1;
      
      a= YYtmp-Xtmp*Htmp;
      b=abs(a);
      ftmp=normpdf(abs(YYtmp-Xtmp*Htmp),miu,sigma);%同一列点上的概率密度,每个点对应四个概率密度
      Aidown=sum(ftmp)+eps;%系数Ai的分母,是一个行向量
      Ai=ftmp./repmat(Aidown,4,1);
      Aiyx=sum((Ai.*YYtmp).*(repmat(Xtmp,1,tmp(1))));
      Aixx=sum(Ai.*((repmat(Xtmp,1,tmp(1))).^2))+eps;
      %channel_we_esti(:,i)=(Aiyx./Aixx)';
      H2=(Aiyx./Aixx)+eps;
      kh(khi)=0;
      kh(khi)=kh(khi)+1;
     
      look_index = 1;
      while abs(sum(abs(H2-Htmp)))>=0.01 &kh(khi)<20
      t = H2 - Htmp ;
      abs_t = abs(t);
      look(look_index) = sum(abs_t) /32;
      look_index = look_index +1;
      Htmp=H2;
      a= YYtmp-Xtmp*Htmp;
      b=abs(a);
      ftmp=normpdf(abs(YYtmp-Xtmp*Htmp),miu,sigma);%同一列点上的概率密度,每个点对应四个概率密度
      Aidown=sum(ftmp)+eps;%系数Ai的分母,是一个行向量
      Ai=ftmp./repmat(Aidown,4,1);
      Aiyx=sum((Ai.*YYtmp).*(repmat(Xtmp,1,tmp(1))));
      Aixx=sum(Ai.*((repmat(Xtmp,1,tmp(1))).^2))+eps;
      %channel_we_esti(:,i)=(Aiyx./Aixx)';
      H2=(Aiyx./Aixx)+eps;
      kh(khi)=kh(khi)+1;
     end
     channel_we_esti(:,n)=(Aiyx./Aixx)'+eps;
     %%%%%%%%%%%%%%%%%%%%%下面的代码用于动态的SIGMA   
     %yyinext=rec_tempo_Signal(:,i+1);
     %YYtmp2=repmat(yyinext',4,1);
     %Htmp2=channel_we_esti(:,i)';
     %a2=YYtmp2-Xtmp*Htmp2;
     %b2=abs(a2);
     %ftmp2=normpdf(abs(YYtmp2-Xtmp*Htmp2),miu,sigma);
     %Aidown2=sum(ftmp2)+eps;
     %b2=sum(repmat(Xtmp,1,32).*ftmp2).*(channel_we_esti(:,i))'./Aidown2;
     %c2=abs(yyinext'-b2);
   % sigma=repmat(c2(1),4,32);
     %sigma=repmat(c2,4,1);
   %sigma=repmat((yyi'-sum(repmat(Xtmp,1,32).*ftmp).*(channel_we_esti(:,i))'),4,1);
  
  end    
  end
      
  for n=Dist*pilotNUM+pilotNUM+1:tmp(2)
      yyi=rec_tempo_Signal(:,n);
      YYtmp=repmat(yyi',4,1);%复制四份以对应四个点
      Htmp=channel_we_esti(:,n-1)';%用于估计的上一列信道
      
      khi=khi+1;
      a= YYtmp-Xtmp*Htmp;
      b=abs(a);
      ftmp=normpdf(abs(YYtmp-Xtmp*Htmp),miu,sigma);%同一列点上的概率密度,每个点对应四个概率密度
      Aidown=sum(ftmp)+eps;%系数Ai的分母,是一个行向量
      Ai=ftmp./repmat(Aidown,4,1);
      Aiyx=sum((Ai.*YYtmp).*(repmat(Xtmp,1,tmp(1))));
      Aixx=sum(Ai.*((repmat(Xtmp,1,tmp(1))).^2))+eps;
      %channel_we_esti(:,i)=(Aiyx./Aixx)';
      H2=(Aiyx./Aixx)+eps;
      kh(khi)=0;
      kh(khi)=kh(khi)+1;
     
      look_index = 1;
      while abs(sum(abs(H2-Htmp)))>=0.01 &kh(khi)<20
      t = H2 - Htmp ;
      abs_t = abs(t);
      look(look_index) = sum(abs_t) /32;
      look_index = look_index +1;
      Htmp=H2;
      a= YYtmp-Xtmp*Htmp;
      b=abs(a);
      ftmp=normpdf(abs(YYtmp-Xtmp*Htmp),miu,sigma);%同一列点上的概率密度,每个点对应四个概率密度
      Aidown=sum(ftmp)+eps;%系数Ai的分母,是一个行向量
      Ai=ftmp./repmat(Aidown,4,1);
      Aiyx=sum((Ai.*YYtmp).*(repmat(Xtmp,1,tmp(1))));
      Aixx=sum(Ai.*((repmat(Xtmp,1,tmp(1))).^2))+eps;
      %channel_we_esti(:,i)=(Aiyx./Aixx)';
      H2=(Aiyx./Aixx)+eps;
      kh(khi)=kh(khi)+1;
     end
      channel_we_esti(:,n)=(Aiyx./Aixx)'+eps;
      %%%%%%%%%%%%%%%%%%%%%下面的代码用于动态的SIGMA   
    if n<tmp(2)
     %yyinext=rec_tempo_Signal(:,i+1);
     %YYtmp2=repmat(yyinext',4,1);
     %Htmp2=channel_we_esti(:,i)';
     %a2=YYtmp2-Xtmp*Htmp2;
     %b2=abs(a2);
     %ftmp2=normpdf(abs(YYtmp2-Xtmp*Htmp2),miu,sigma);
     %Aidown2=sum(ftmp2)+eps;
     %b2=sum(repmat(Xtmp,1,32).*ftmp2).*(channel_we_esti(:,i))'./Aidown2;
     %c2=abs(yyinext'-b2);
     %sigma=repmat(c2,4,1);
    %sigma=repmat(c2(1),4,32);
    %sigma=repmat((yyi'-sum(repmat(Xtmp,1,32).*ftmp).*(channel_we_esti(:,i))'),4,1);
   end
  end    
      
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -