demodulate_sig.m

来自「16QAM的数字通信系统的仿真」· M 代码 · 共 36 行

M
36
字号
function y=demodulate_sig(x1,x2)
%解调
%x1=[3 -1 -3 1];
%x2=[-3 1 3 -1];
xx1(find(x1>=2))=3;
xx1(find((x1<2)&(x1>=0)))=1;
xx1(find((x1>=-2)&(x1<0)))=-1;
xx1(find(x1<-2))=-3;
xx2(find(x2>=2))=3;
xx2(find((x2<2)&(x2>=0)))=1;
xx2(find((x2>=-2)&(x2<0)))=-1;
xx2(find(x2<-2))=-3;
%xxx1=xx1
%xxx2=xx2
temp1=zeros(1,length(xx1)*2);
temp1(find(xx1==-1)*2)=1;
temp1(find(xx1==1)*2-1)=1;
temp1(find(xx1==1)*2)=1;
temp1(find(xx1==3)*2-1)=1;
temp2=zeros(1,length(xx2)*2);
temp2(find(xx2==-1)*2)=1;
temp2(find(xx2==1)*2-1)=1;
temp2(find(xx2==1)*2)=1;
temp2(find(xx2==3)*2-1)=1;
%x11=temp1
%x22=temp2
n = length(temp1);
for i = 1:2:2*n-1
    y(i) = temp1((i+1)/2);
    y(i+1) = temp2((i+1)/2);
end




⌨️ 快捷键说明

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