Main Content


Competitive transfer function

Graph and Symbol


A = compet(N,FP)
info = compet('code')


compet is a neural transfer function. Transfer functions calculate a layer’s output from its net input.

A = compet(N,FP) takes N and optional function parameters,


S-by-Q matrix of net input (column) vectors


Struct of function parameters (ignored)

and returns the S-by-Q matrix A with a 1 in each column where the same column of N has its maximum value, and 0 elsewhere.

info = compet('code') returns information according to the code string specified:

compet('name') returns the name of this function.

compet('output',FP) returns the [min max] output range.

compet('active',FP) returns the [min max] active input range.

compet('fullderiv') returns 1 or 0, depending on whether dA_dN is S-by-S-by-Q or S-by-Q.

compet('fpnames') returns the names of the function parameters.

compet('fpdefaults') returns the default function parameters.


Here you define a net input vector N, calculate the output, and plot both with bar graphs.

n = [0; 1; -0.5; 0.5];
a = compet(n);
subplot(2,1,1), bar(n), ylabel('n')
subplot(2,1,2), bar(a), ylabel('a')

Assign this transfer function to layer i of a network.

net.layers{i}.transferFcn = 'compet';

Version History

Introduced before R2006a

See Also