decon_perturb.m
来自「基于Matlab的模拟退火算法工具箱」· M 代码 · 共 40 行
M
40 行
function Wnew = decon_perturb(X,W,Ea,T)
% Mnew = decon_perturb(X,W)
% Method for seismicdecon example supplied with SA Tools.
% See http://www.frostconcepts.com/software for information on SA Tools.
%
% Mnew = decon_perturb(X,W,Ea,T) ;
%
% X = (not used) problem definition
% W = {alpha tau K}
% alpha = attenuation values
% tau = translation values
% K = length of alpha, tau vectors
% Ea = (not used) average energy.
% T = (not used) current temperature.
%
% Perturbs a random element of alpha or tau (not both).
% Checks to make sure perturbation is within reasonable bounds.
%
[alpha,tau,K] = modelparts(W) ;
choice = rand ;
element = ceil(rand*K) ;
amount = rand ;
if choice < .5
% perturb alpha
alpha(element) = (0.5 + rand)*alpha(element) ;
if alpha(element) < 0
alpha(element) = 0 ;
elseif alpha(element) > 1
alpha(element) = 1 ;
end
else
% perturb tau
tau(element) = ceil((0.5 + rand)*tau(element)) ;
if tau(element) < 0
tau(element) = 0 ;
elseif tau(element) > 2000
tau(element) = 2000 ;
end
end
Wnew = {alpha tau K} ;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?