Main Content


Summing junction for name-based interconnections


S = sumblk(formula)
S = sumblk(formula,signalsize)
S = sumblk(formula,signames1,signames2,...)


S = sumblk(formula) creates the transfer function, S, of the summing junction described by formula. The character vector formula specifies an equation that relates the scalar input and output signals of S.

S = sumblk(formula,signalsize) returns a vector-valued summing junction. The input and output signals are vectors with signalsize elements.

S = sumblk(formula,signames1,signames2,...) replaces aliases (signal names beginning with %) in formula by the signal names signames. The number of signames arguments must match the number of aliases in formula. The first alias in formula is replaced by signames1, the second by signames2, and so on.

Input Arguments


Equation that relates the input and output signals of the summing junction transfer function S, specified as a character vector. For example, the following command:

S = sumblk('e = r - y + d')

creates a summing junction with input names 'r', 'y', and 'd', output name 'e' and equation e = r-y+d.

If you specify a signalsize greater than 1, the inputs and outputs of S are vector-valued signals. sumblk automatically performs vector expansion of the signal names of S. For example, the following command:

S = sumblk('v = u + d',2)

specifies a summing junction with input names {'u(1)';'u(2)';'d(1)';'d(2)'} and output names {'v(1)';'v(2)'}. The formulas of this summing junction are v(1) = u(1) + d(1); v(2) = u(2) + d(2).

You can use one or more aliases in formula to refer to signal names defined in a variable. An alias is a signal name that begins with %. When formula contains aliases, sumblk replaces each alias with the corresponding signames argument.

Aliases are useful when you want to name individual entries in a vector-valued signal. Aliases also allow you to use input or output names of existing models. For example, if C and G are dynamic system models with nonempty InputName and OutputName properties, respectively, you can create a summing junction using the following expression.

S = sumblk('%e = r - %y',C.InputName,G.OutputName)

sumblk uses the values of C.InputName and G.OutputName in place of %e and %y, respectively. The vector dimension of C.InputName and G.OutputName must match. sumblk assigns the signal r the same dimension.


Number of elements in each input and output signal of S. Setting signalsize greater than 1 lets you specify a summing junction that operates on vector-valued signals.

Default: 1


Signal names to replace one alias (signal name beginning with %) in the argument formula. You must provide one signames argument for each alias in formula.

Specify signames as:

  • A cell array of signal names.

  • The InputName or OutputName property of a model in the MATLAB® workspace. For example:

    S = sumblk('%e = r - y',C.InputName)

    This command creates a summing junction whose outputs have the same name as the inputs of the model C in the MATLAB workspace.

Output Arguments


Transfer function for the summing junction, represented as a MIMO tf model object.


Summing Junction with Scalar-Valued Signals

Create the summing junction of the following illustration. All signals are scalar-valued.

This summing junction has the formula u = u1 + u2 + u3.

S = sumblk('u = u1+u2+u3');

S is the transfer function (tf) representation of the sum u = u1 + u2 + u3. The transfer function S gets its input and output names from the formula.

ans = 


ans = 


Summing Junction with Vector-Valued Signals

Create the summing junction v = u - d where u,d,v are vector-valued signals of length 2.

S = sumblk('v = u-d',2);

sumblk automatically performs vector expansion of the signal names of S.

ans = 


ans = 


Summing Junction with Vector-Valued Signals That Have Specified Signal Names

Create the summing junction


The signals alpha and q have custom names that are not merely the vector expansion of a single signal name. Therefore, use an alias in the formula specifying the summing junction.

S = sumblk('e = setpoint - %y + d', {'alpha';'q'});

sumblk replaces the alias %y with the cell array {'alpha';'q'}.

ans = 


ans = 



  • Use sumblk in conjunction with connect to interconnect dynamic system models and derive aggregate models for block diagrams.

Introduced in R2008a