sumblk
Summing junction for namebased interconnections
Syntax
S = sumblk(formula)
S = sumblk(formula,signalsize)
S = sumblk(formula,signames1,signames2,...)
Description
creates
the transfer function, S
= sumblk(formula
)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
.
returns
a vectorvalued summing junction. The input and output signals are
vectors with S
= sumblk(formula
,signalsize
)signalsize
elements.
replaces
aliases (signal names beginning with S
= sumblk(formula
,signames1,signames2,...)%
) 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 = sumblk('e = r  y + d') creates a summing junction with input names If you specify a S = sumblk('v = u + d',2) specifies a summing junction with input names You can use one or more aliases in Aliases are useful when you want to name individual entries
in a vectorvalued signal. Aliases also allow you to use input or
output names of existing models. For example, if S = sumblk('%e = r  %y',C.InputName,G.OutputName)


Number of elements in each input and output signal of Default: 1 

Signal names to replace one alias (signal name beginning with Specify

Output Arguments

Transfer function for the summing junction, represented as a
MIMO 
Examples
Summing Junction with ScalarValued Signals
Create the summing junction of the following illustration. All signals are scalarvalued.
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.
S.OutputName,S.Inputname
ans = 'u' ans = 'u1' 'u2' 'u3'
Summing Junction with VectorValued Signals
Create the summing junction v = u  d
where u,d,v
are
vectorvalued signals of length 2.
S = sumblk('v = ud',2);
sumblk
automatically performs vector expansion
of the signal names of S
.
S.OutputName,S.Inputname
ans = 'v(1)' 'v(2)' ans = 'u(1)' 'u(2)' 'd(1)' 'd(2)'
Summing Junction with VectorValued Signals That Have Specified Signal Names
Create the summing junction
$$\begin{array}{l}\text{e}\left(1\right)=\text{setpoint}\left(1\right)\text{alpha}+\text{d}\left(1\right)\\ \text{e}\left(2\right)=\text{setpoint}\left(2\right)\text{q}+\text{d}\left(2\right)\end{array}$$
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'}
.
S.OutputName,S.Inputname
ans = 'e(1)' 'e(2)' ans = 'setpoint(1)' 'setpoint(2)' 'alpha' 'q' 'd(1)' 'd(2)'
Tips
Use
sumblk
in conjunction withconnect
to interconnect dynamic system models and derive aggregate models for block diagrams.