equal

Navigation:  Language Reference > Functions > Expansion >

equal

Previous pageReturn to chapter overviewNext page

Syntax

equal([x1,x2, ...,xn]);

Description

This function is used to make all elements of a matrix equal. It returns the equations x2 = x1, x3 = x1,  .. , xn = x1. During processing the equations will be automatically reshaped into a proper causal form. This function is created for use in library models that use a matrix with unknown size which results from the collect function.

Examples

Suppose we have m bonds connected to a submodel, collected in a port p. We could then use the function:

 

collect(p.e);

 

During processing this equation will be expanded as:

 

[p.e1;p.e2;...;p.n];

 

If we use the equal function:

 

equal(collect(p.e));

 

this results in:

 

equal([p.e1;p.e2;...;p.n]);

 

which will be expanded in:

 

p.e2 = p.e1;

p.e3 = p.e1;

..

p.en = p.e1

 

Limitations

This function is designed for a special class of models and should be used by experienced users only!