Main Content

hardlim

Hard-limit transfer function

Description

example

A = hardlim(N) takes an S-by-Q matrix of net input (column) vectors, N, and returns A, the S-by-Q Boolean matrix with elements equal to 1 where the corresponding elements in N are greater than or equal to 0.

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

Plot of the hard-limit transfer function. For inputs greater than or equal to 0, the function returns 1. For inputs less than 0, the function returns 0.

info = hardlim('code') returns useful information for each code character vector:

  • hardlim('name') returns the name of this function.

  • hardlim('output') returns the [min max] output range.

  • hardlim('active') returns the [min max] active input range.

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

  • hardlim('fpnames') returns the names of the function parameters.

  • hardlim('fpdefaults') returns the default function parameters.

Examples

collapse all

This example shows how to create a plot of the hardlim transfer function.

Create the input matrix, n. Then call the hardlim function and plot the results.

n = -5:0.1:5;
a = hardlim(n);
plot(n,a)

Assign this transfer function to layer i of a network.

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

Input Arguments

collapse all

Net input column vectors, specified as an S-by-Q matrix.

Output Arguments

collapse all

Output matrix, returned as an S-by-Q Boolean matrix with elements equal to 1 where the corresponding elements in N are greater than or equal to 0.

Algorithms

hardlim(n) = 1 if n ≥ 0

                         0 otherwise

Version History

Introduced before R2006a

See Also

|