MATLAB Examples

Solve a Linear System of Algebraic Equations

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$