sum

Navigation:  Language Reference > Functions > Expansion >

sum

Previous pageReturn to chapter overviewNext page

Syntax

y = sum([x1,x2, ...,xn]);

Description

This function is used for summation of variables of which one may be unknown. It returns the equation y = x1 + x2 + .. xn. During processing this equation will be automatically reshaped into a causal form.

 

This function is created for use in library models that have unknown inputs such as PlusMinus model. Try to avoid the use of this function!

Examples

equations

after reshaping (processing)

x1 = 1;

x2 = 2;

0 = sum(x1,x2,x3);

 

x1 = 1;

x2 = 2;

x3 = x1 + x2;

 

y = sin(time);

x2 = 2;

y = sum(x1,x2);

y = sin(time);

x2 = 2;

x1 = y - x2;

 

Limitations

This function is designed for a special class of models and should be used by experienced users only! y, x1, x2, ..,xn must be scalars. n may be 1 or higher.
Use the function msum if you want to use a standard summation of multiple variables.