findDecoupledBlocks
Splits a system of equations into blocks that can be solved independently.
Category: Mathematics > Equation Solving
Syntax
[eqBlocks, varBlocks] = findDecoupledBlocks(eqs, vars)
Returns the groups of equations and variables that do not depend on each other.
Description
The function inspects which variables appear in which equations and finds the connected groups. Each block can be solved on its own, which shrinks large DAE or ODE systems into smaller ones.
Input arguments
eqs- Vector of equations in the symbolic functions
vars. vars- Vector of symbolic functions such as
[x1(t) x2(t)].
Output arguments
eqBlocks- Cell array; each cell holds the indices of the equations in one block.
varBlocks- Cell array of the indices of the variables of each block.
Example
A coupled pair and an isolated equation
syms x1(t) x2(t) x3(t)
eqs = [x1 + x2 == 1, x1 - x2 == 0, x3 == 2];
[eqb, varb] = findDecoupledBlocks(eqs, [x1 x2 x3]);
eqb
varb
Output
eqb = 1×2 cell
{[1 2]} {[3]}
varb = 1×2 cell
{[1 2]} {[3]}