satlin.m

来自「神经网络设计书籍配套源码(matlab平台)」· M 代码 · 共 32 行

M
32
字号
function a = satlin(n,b)
%SATLIN Saturating linear transfer function.
%	
%	SATLIN(N)
%	  N - SxQ Matrix of net input (column) vectors.
%	Returns values of N truncated into the interval [0, 1].
%	
%	EXAMPLE: n = -10:0.1:10;
%	         a = satlin(n);
%	         plot(n,a)
%	
%	SATLIN(Z,B) ...Used when Batching.
%	  Z - SxQ Matrix of weighted input (column) vectors.
%	  B - Sx1 Bias (column) vector.
%	Returns truncated values of N, where N is found by adding
%	  B to each column of Z.

% Mark Beale, 1-31-92
% Revised 12-15-93, MB
% Copyright (c) 1992-94 by the MathWorks, Inc.
% $Revision: 1.1 $  $Date: 1994/01/11 16:28:32 $

if nargin < 1, error('Not enough arguments.'); end

if nargin==2
  [nr,nc] = size(n);
  n = n + b*ones(1,nc);
end
less = (n < 0);
greater = (n > 1);
a = (~(less | greater)).*n + greater;

⌨️ 快捷键说明

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