📄 qam16encode_new.m
字号:
%16QAM modulation mapping
%N is the number of output symbol
%qam_sig is the output complex QAM signal vector
%the power of qam_sig is normalized to 1 per symbol.
%qam_bit is the output 4-bit vector
function [qam_sig]=QAM16encode_new(encod1)
N=length(encod1);
lrem=rem(N,4);
if lrem~=0
encod1(N+1:N+(4-lrem))=0;
end
NN=length(encod1);
d=sqrt(40/40);%to normalize the energy of the QAM symbol
%d=1;
ConsI=[-3*d -d d d*3];
ConsQ=[-3*d -d d d*3];
I=[1 1;0 1;0 0;1 0];
Q=[1 1;0 1;0 0;1 0];
for i1=0:4:NN-1,
% encode bit map
nu1=[encod1(i1+1) encod1(i1+3)];
nu2=[encod1(i1+2) encod1(i1+4)];
for j=1:4
eu1(j)=(nu1-I(j,:))*(nu1-I(j,:))';
eu2(j)=(nu2-Q(j,:))*(nu2-Q(j,:))';
end
[mineu1,index1]=min(eu1);
[mineu2,index2]=min(eu2);
qam_sig(i1/4+1)=ConsI(index1)+i*ConsQ(index2);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -