📄 maxt.m
字号:
% File: maxt.m
% Description:
% Use of the Hamming bound to determine the maximum correcting capability
% given the dimension of the code and number of redundant bits.
% Copyright (c) 2005. Robert Morelos-Zaragoza. All rights reserved.
k = input('Input the number of information bits, k = ');
r = input('Input the number of redundant bits, n-k = ');
n = k+r;
t = 0; % Inital value of error correcting capability
test = 0; % To test if bound is still 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
t = t+1;
else
t=t-1;
test = 1;
end
end
fprintf('The maximum correcting capability is t = %d\n',t);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -