ip_08_08.m

来自「Proakis《contemporarycommunication system」· M 代码 · 共 23 行

M
23
字号
% MATLAB script for Illustrative Problem 8, Chapter 8. 
% Generate U, denoting all information sequences.
k=4;
for i=1:2^k
  for j=k:-1:1
    if rem(i-1,2^(-j+k+1))>=2^(-j+k)
      u(i,j)=1;
    else
      u(i,j)=0;
    end
  end
end
% Define G, the generator matrix.
g=[1 0 0 1 1 1 0 1 1 1;
   1 1 1 0 0 0 1 1 1 0;
   0 1 1 0 1 1 0 1 0 1;
   1 1 0 1 1 1 1 0 0 1];
% Generate codewords
c=rem(u*g,2);
% Find the minimum distance.
w_min=min(sum((c(2:2^k,:))'));

⌨️ 快捷键说明

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