qam_slicer.m

来自「这是一个完整的数据传输过程的matlab例程!」· M 代码 · 共 44 行

M
44
字号
function y = QAM_Slicer(Y,Nbits,opt);% y = QAM_Slicer(Y,Nbits);%% Slices a QAM signal with Nbits resolution of both I and Q% components. %% Input parameters:%     Y       complex input (scalar or vector)%     Nbits   resolution of real and imag part of Y%     opt     opt='norm' sets re-normlaisation to unit variance%% Output parameters:%     y       2*2^Nbit QAM symbol   Ly = length(Y);Levels = 2^Nbits;% rescalingScale = [0.7071;   1.5811;   3.2404;   6.5192];Y = Y*Scale(Nbits);% **** decision slicer ****i = round(real(Y)+(Levels-1)/2);i(i<0) = 0;i(i>(Levels-1)) = Levels-1;q = round(imag(Y)+(Levels-1)/2);q(q<0) = 0;q(q>(Levels-1)) = Levels-1;% restore QAM symboly = i-(Levels-1)/2 + sqrt(-1)*(q-(Levels-1)/2);if exist('opt'),   if opt=='renorm',       y = y/Scale(Nbits);   end;end;

⌨️ 快捷键说明

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