• 大小: 8KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: 其他
  • 标签: qam调制  

资源简介

给出了两种8qam调制方法和2种解调方法,通过比较得出误比特率情况

资源截图

代码片段和文件信息

function  sout = demodu_8qam_cir( sinabtype )

%%%%%%%%%%%%%%%%%%%%%%%% baisc parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N = length(sin);
sout = zeros(1N);
Psum = (2*b*b+a*a)/2;
Prms = sqrt(Psum);
%%%%%%%%%%%%%%%%%%%%%%%%%% demodilate 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 if type==1;
am = zeros(1N);
thita = zeros(1N);
c =0.5*(a + b*sqrt(2))/Prms;
lable = b*sqrt(2)>a;
for i=1:N;
am(i) = abs(sin(i));
thita(i) = angle(sin(i));
flag = am(i) > c;
if (~xor(flaglable))
    if(thita(i)>0 && thita(i)        sout(i) = 1;
    elseif(thita(i)>pi/2 && thita(i)        sout(i) = 2;
    elseif(thita(i)>-pi && thita(i)<-pi/2)
        sout(i) = 7; 
      else
        sout(i) = 4;
     end;            
else
   if(thita(i)>-pi/4 && thita(i)           sout(i) = 0;
     elseif(thita(i)>pi/4 && thita(i)<3*pi/4)
           sout(i) = 3;
      elseif(thita(i)>-3*pi/4 && thita(i)<-pi/4)
           sout(i) = 5;
     else
           sout(i) = 6;
    end;   
end;

%%%%%%%%%%%%%%%%%%%%%%%%%% 格雷解码 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 if sout(i)==2;sout(i)=3;
    elseif sout(i)==3;sout(i)=2;
    elseif sout(i)==4;sout(i)=7;
    elseif sout(i)==5;sout(i)=6;
    elseif sout(i)==6;sout(i)=4;
    elseif sout(i)==7;sout(i)=5;
  else
     sout(i)=sout(i);
  end;
end;

%%%%%%%%%%%%%%%%%%%%%%%%%% demodilate 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif type == 2;
    xp = [ab-b0b0-a-b]/Prms;
    yp = [0bba-b-a0-b]/Prms; 
    dis =zeros(18);
    for i=1:N;
        for j=1:8
        dis(j) = sqrt((real(sin(i))-xp(j)).^2 + (imag(sin(i))-yp(j)).^2);
        end;
        [xxnum] = min(dis);
        sout(i) = num-1;
%%%%%%%%%%%%%%%%%%%%%%%%%% 格雷解码 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 if sout(i)==2;sout(i)=3;
    elseif sout(i)==3;sout(i)=2;
    elseif sout(i)==4;sout(i)=7;
    elseif sout(i)==5;sout(i)=6;
    elseif sout(i)==6;sout(i)=4;
    elseif sout(i)==7;sout(i)=5;
 else
     sout(i)=sout(i);
 end;
    end;
    
%%%%%%%%%%%%%%%%%%%%%%%%%% demodilate 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
elseif type == 3;        
end;

%%%%%%%%%%%%%%%%%%% change the octal sequnece into binary sequnece %%%%%%%%%%%%%%%%%%% 
sout = de2bi(sout3‘left-msb‘);
sout = reshape(sout‘13*N);       %change the octal sequnece into binary sequnece
sout = sout‘;   
%%%%%%%%%%%%%%%%%%%%%%   End    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        2421  2013-05-05 21:25  demodu_8qam_cir.m
     文件        3207  2013-05-05 21:25  demodu_8qam_mat.m
     文件         993  2013-05-05 21:25  mapping_cir.m
     文件         974  2013-05-05 21:25  mapping_mat.m
     文件        1265  2013-05-05 21:25  modu_8qam_cir.m
     文件        1250  2013-05-05 21:25  modu_8qam_mat.m
     文件        3560  2013-05-05 21:25  work1.m
     文件        1651  2013-05-05 21:25  work2.m
     文件        1553  2013-05-05 21:25  work3.m
     文件        1851  2013-05-05 21:25  work4.m

评论

共有 条评论