bit2num.m

来自「一个启发式搜索算法  给初学者用的 随便参考着用  提供了多种策略」· M 代码 · 共 11 行

M
11
字号
function y=bit2num(th_bit,b,thetmin,thetmax)
% J. C. Spall, August 1999
% For the relevant element of theta (say, the jth), this function converts bit 
% representation to floating point no. with M(j) 
% decimal places of accuracy (the M vector used in GAbit_roulette).  
%           
y=0;
for i=1:b
   y=y+th_bit(b+1-i)*2^(i-1);
end
y=thetmin+(thetmax-thetmin)*y/(2^b-1);

⌨️ 快捷键说明

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