Main Content

Algebraic Constraint

Constrain input signal

  • Algebraic Constraint block

Libraries:
Simulink / Math Operations

Description

The Algebraic Constraint block constrains the input signal f(z) to z or 0 and outputs an algebraic state z. The block outputs a value that produces 0 or z at the input. The output must affect the input through a direct feedback path. In other words, the feedback path only contains blocks with direct feedthrough. For example, you can specify algebraic equations for index 1 differential-algebraic systems (DAEs).

Examples

expand all

Use the Algebraic Constraint block to solve the system

$$\begin{array}{c} z_1 + z_2 = 1\\ z_2 - z_1 = 1\end{array}$$

The model represents the problem in a vectorized form as

$$
 \left[\begin{array}{cc}
1 & 1\\
-1& 1
\end{array}\right]\left[\begin{array}{c}z_1\\z_2\end{array}\right]
=\left[\begin{array}{c}1\\1\end{array}\right]
$$

The signal fed to the Algebraic Constraint block $f(z)$ is a $2\times1$ vector of the form

$$\left[\begin{array}{c}z_1+z_2-1\\-z-1 +
z_2-1\end{array}\right] $$

The block is configured to constrain $f(z)$ to 0. Thus solving for $f(z) = 0$ yields the solution $z_1 = 0,\, z_2 = 1$

Extended Examples

Ports

Input

expand all

Signal is subjected to the constraint f(z) = 0 or f(z) = z to solve the algebraic loop.

Data Types: double

Output

expand all

Solution to the algebraic loop when the input signal f(z) is subjected to the constraint f(z) = 0 or f(z) = z.

Data Types: double

Parameters

expand all

Type of constraint for which to solve. You can solve for f(z) = 0 or f(z) = z

Programmatic Use

Block Parameter: Constraint
Type: character vector
Values: 'f(z) = 0' | 'f(z) = z'
Default: 'f(z) = 0'

Choose between the Trust region [1], [2] or Line search [3] algorithms to solve the algebraic loop. By default this value is set to auto, which selects the algebraic loop solver based on the model configuration and switches the solver between the Trust region and Line search algorithm during simulation

Programmatic Use

Block Parameter: Solver
Type: character vector
Values: 'auto' | 'Trust region' | 'Line search'
Default: 'auto'

This option is visible when you explicitly specify a solver to be used (Trust region or Line Search) in the Solver drop-down menu. Specify a smaller value for higher accuracy or a larger value for faster execution. By default it is set to auto.

Programmatic Use

Block Parameter: Tolerance
Type: character vector
Values: 'auto' | positive scalar
Default: 'auto'

Initial guess for the algebraic state z that is close to the expected solution value to improve the efficiency of the algebraic loop solver. By default, this value is set to 0

Programmatic Use

Block Parameter: InitialGuess
Type: character vector
Values: scalar
Default: '0'

Block Characteristics

Data Types

double

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

References

[1] Garbow, B. S., K. E. Hillstrom, and J. J. Moré. User Guide for MINPACK-1. Argonne, IL: Argonne National Laboratory, 1980.

[2] Rabinowitz, P. H. Numerical Methods for Nonlinear Algebraic Equations. New York: Gordon and Breach, 1970.

[3] Kelley, C. T. Iterative Methods for Linear and Nonlinear Equations. Society for Industrial and Applied Mathematics, Philadelphia, PA: 1995.

Extended Capabilities

Version History

Introduced before R2006a