📄 demodulation.m
字号:
function y = demodulation(x,b,e,h)
% function y = demodulation(x,b,e,h)
% find the smybol in the defined modulation scheme map which has the minimum distance to the received symbol,
% output the binary code corresponding to the index
% x is input symbols, in the form of row vector
% y is demodulated output, in the form of row vector
% b is the subcarrier bit allocation, b(i) is the number of bits allocated to ith subcarrier
% e is the subcarrier energy allocation, same size as b
% h is the channel value in frequency for all subcarriers. X_estimate = X / H
% ------- demodulation.m -----------------------------------
% Black team
% April-11-05
% ----------------------------------------------------------
% load the modulation sheme
load bpsk.mat;
load qpsk.mat;
load 16qam.mat;
load 64qam.mat;
load 256qam.mat;
y=[];
for i = 1:length(b)
switch b(i)
case{1}
[value index] = min( abs( p2 - x(i)/sqrt(e(i))/h(i) ) );
y = [y d2(index,:)];
case{2}
[value index] = min( abs( p4 - x(i)/sqrt(e(i))/h(i) ) );
y = [y d4(index,:)];
case{4}
[value index] = min( abs( p16 - x(i)/sqrt(e(i))/h(i) ) );
y = [y d16(index,:)];
case{6}
[value index] = min( abs( p64 - x(i)/sqrt(e(i))/h(i) ) );
y = [y d64(index,:)];
case{8}
[value index] = min( abs( p256 - x(i)/sqrt(e(i))/h(i) ) );
y = [y d256(index,:)];
otherwise
index = 0;
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -