⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mylog.m

📁 The Source of Genetic Programming developed in Matlab
💻 M
字号:
function y=mylog(x)
%MYLOG    Protected LOG function, equal to Koza.
%   MYLOG(X) returns zero if X=0 and LOG(ABS(X)) otherwise.
%
%   Input arguments:
%      X - the number to log (double)
%   Output arguments:
%      Y - the natural logarithm of X, or zero (double)
%
%   See also MYLOG2, MYLOG10, MYSQRT, MYDIVIDE, MYPOWER
%
%   Copyright (C) 2003-2007 Sara Silva (sara@dei.uc.pt)
%   This file is part of the GPLAB Toolbox

% fill the cells where x=0 (make them 0):
y=zeros(size(x));

% fill the remaining cells with the result of the logarithm:
i=find(x~=0);
y(i)=log(abs(x(i)));

⌨️ 快捷键说明

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