📄 minred.m
字号:
% File: minred.m
% Description:
% Use of the Hamming bound to find the number of redundant bits given
% the dimension of the code and desired error correcting capability.
% Copyright (c) 2005. Robert Morelos-Zaragoza. All rights reserved.
k = input('Input the number of information bits, k = ');
t = input('Input the desired error correcting capability, t = ');
n = k+1; % Inital value of length
test = 0; % To test if bound is satisfied
while test ~= 1
% Compute the volume of a Hamming sphere of radius t
S = 0;
for i=0:t
S = S + nchoosek(n,i);
end
% Compare with the number of syndromes
if 2^(n-k) >= S
test = 1;
else
n = n+1;
end
end
fprintf('The minimum number of redundant bits is n-k = %d\n',n-k);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -