⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cm_dpske.asv

📁 根据蒙特卡罗仿真原理
💻 ASV
字号:
%***********************************************************************
% cm_dpske.m
% cm_dpske  finds the probability of bit error and symbol error for the 
% given value of snr_in_dB, signal-to-noise ratio in dB.
% Programmed by Liu Dejian
% Dtat:2008-3-8
%***********************************************************************
function[enc_comp]=cm_dpske(E,M,mapping,sequence)
%   [enc_comp] = cm_dpske(E,M,mapping,sequence)
% 		CM_DPSKE differentially encodes a sequence.
% 		    E is the average energy, M is the number of constellation points,
% 		    and mapping is the vector defining how the constellation points are 
% 		    allocated. Finally,"sequence"is the uncoded binary data sequence. 

k=log2(M);
N=length(sequence);
% If N is not divisible by k, append zeros, so that it is...
%如果N不可为k整除,填充零使其可被k整除
remainder=rem(N,k);
if (remainder~=0),
  for i=N+1:N+k-remainder,   
     sequence(i)=0;
  end;
  N=N+k-remainder;
end;
% Initially, assume that theta=0.
% 最初,
theta=0;
for i=1:k:N,
   index=0;
   for j=i:i+k-1,
      index=2*index+sequence(j);
   end;
   index=index+1;
   theta=mod(2*pi*mapping(index)/M+theta,2*pi);
   enc_comp((i+k-1)/k,1)=sqrt(E)*cos(theta);
   enc_comp((i+k-1)/k,2)=sqrt(E)*sin(theta);
end;
       

⌨️ 快捷键说明

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