Main Content

netsum

Sum net input function

Syntax

N = netsum({Z1,Z2,...,Zn},FP)
info = netsum('code')

Description

netsum is a net input function. Net input functions calculate a layer’s net input by combining its weighted inputs and biases.

N = netsum({Z1,Z2,...,Zn},FP) takes Z1 to Zn and optional function parameters,

Zi

S-by-Q matrices in a row cell array

FP

Row cell array of function parameters (ignored)

and returns the elementwise sum of Z1 to Zn.

info = netsum('code') returns information about this function. The following codes are supported:

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

netsum('type') returns the type of this function.

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

netsum('fpdefaults') returns default function parameter values.

netsum('fpcheck', FP) throws an error for illegal function parameters.

netsum('fullderiv') returns 0 or 1, depending on whether the derivative is S-by-Q or N-by-S-by-Q.

Examples

Here netsum combines two sets of weighted input vectors and a bias. You must use concur to make b the same dimensions as z1 and z2.

z1 = [1, 2, 4; 3, 4, 1]
z2 = [-1, 2, 2; -5, -6, 1]
b = [0; -1]
n = netsum({z1, z2, concur(b, 3)})

Assign this net input function to the first layer of a network.

net = feedforwardnet(); 
net.layers{1}.netInputFcn = 'netsum';

Version History

Introduced before R2006a