qam16demod.m
来自「自己编写的简单易懂的OFDM通信系统仿真程序」· M 代码 · 共 127 行
M
127 行
%16-QAM解调
function [demodata]=qam16demod(ich,qch,para);
d=1/sqrt(10);
for ii=1:para
if ich(ii)>=0
if qch(ii)>=0
if ich(ii)>=2*d
if qch(ii)>=2*d
temp(ii,1)=0;
temp(ii,2)=0;
temp(ii,3)=0;
temp(ii,4)=0;
else
temp(ii,1)=0;
temp(ii,2)=1;
temp(ii,3)=0;
temp(ii,4)=0;
end
else
if qch(ii)>=2*d
temp(ii,1)=0;
temp(ii,2)=0;
temp(ii,3)=0;
temp(ii,4)=1;
else
temp(ii,1)=0;
temp(ii,2)=1;
temp(ii,3)=0;
temp(ii,4)=1;
end
end
else
if ich(ii)>=2*d
if qch(ii)>=-2*d
temp(ii,1)=1;
temp(ii,2)=1;
temp(ii,3)=0;
temp(ii,4)=0;
else
temp(ii,1)=1;
temp(ii,2)=0;
temp(ii,3)=0;
temp(ii,4)=0;
end
else
if qch(ii)>=-2*d
temp(ii,1)=1;
temp(ii,2)=1;
temp(ii,3)=0;
temp(ii,4)=1;
else
temp(ii,1)=1;
temp(ii,2)=0;
temp(ii,3)=0;
temp(ii,4)=1;
end
end
end
else
if qch(ii)>=0
if ich(ii)>=-2*d
if qch(ii)>=2*d
temp(ii,1)=0;
temp(ii,2)=0;
temp(ii,3)=1;
temp(ii,4)=1;
else
temp(ii,1)=0;
temp(ii,2)=1;
temp(ii,3)=1;
temp(ii,4)=1;
end
else
if qch(ii)>=2*d
temp(ii,1)=0;
temp(ii,2)=0;
temp(ii,3)=1;
temp(ii,4)=0;
else
temp(ii,1)=0;
temp(ii,2)=1;
temp(ii,3)=1;
temp(ii,4)=0;
end
end
else
if ich(ii)>=-2*d
if qch(ii)>=-2*d
temp(ii,1)=1;
temp(ii,2)=1;
temp(ii,3)=1;
temp(ii,4)=1;
else
temp(ii,1)=1;
temp(ii,2)=0;
temp(ii,3)=1;
temp(ii,4)=1;
end
else
if qch(ii)>=-2*d
temp(ii,1)=1;
temp(ii,2)=1;
temp(ii,3)=1;
temp(ii,4)=0;
else
temp(ii,1)=1;
temp(ii,2)=0;
temp(ii,3)=1;
temp(ii,4)=0;
end
end
end
end
end
demodata=temp;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?