📄 qdemodulator.m
字号:
function yrx=qdemodulator(x,M)
%Carlos 26/03/06; AAU; DK
datadec=0;
K=log2(M); %number of bits per symbol
switch M %cases for each modulation
case 2
load qam2;
case 4
load qam4;
case 8
load qam8;
case 16
load qam16;
case 32
load qam32;
case 64
load qam64;
case 128
load qam128;
case 256
load qam256;
end
ly=length(yqmod); %variable yqmod has the constellation selected using case
lx=length(x); %x contains the bits after the channel(information + noise)
for g=1:lx
[tmp,index]=min(abs(yqmod-x(g))); %evaluating the complex modulus
symdec=index-1; %decimal value of data
datadec=[datadec,symdec];
end
nydatadec=datadec(2:length(datadec)); %the first element doesn't count
yrx=0;
yrx=de2bi(nydatadec,'left-msb',K); %from decimal to binary
yrx=reshape(yrx.',prod(size(yrx)),1)'; %data recovered
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -