?? compet.m
字號(hào):
function a = compet(n,b)
%COMPET Competitive transfer function.
%
% COMPET(N)
% N - SxQ matrix of net input (column) vectors.
% Returns the output vectors with 1 where each net input
% vector had its maximum value, and 0 elsewhere.
%
% EXAMPLE: n = [0.0; 0.2; 0.6; 0.1];
% a = compet(n)
%
% COMPET(Z,B) ...Used when Batching.
% Z - SxQ Matrix of weighted input (column) vectors.
% B - Sx1 Bias (column) vector.
% Returns results of applying competition to net input values
% 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:23:53 $
if nargin < 1,error('Not enough arguments.'); end
[S,Q] = size(n);
[nr,nc] = size(n);
if nargin==2
n = n + b*ones(1,nc);
end
if nr == 1
a = ones(S,Q);
else
a = sparse([],[],[],nr,nc,nc);
y = max(n);
for i=1:nc
ind = find(n(:,i) == y(i));
a(ind(1),i) = 1;
end
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -