Solve Blocks > Example: Solving Nonlinear Systems of Equations
Example: Solving Nonlinear Systems of Equations
Use solve blocks to solve a system of n equations in n unknowns.
1. Insert a solve block and define the guess values, the constraints and the solver function Find.
Click to copy this expression
2. Evaluate vec:
Click to copy this expression
Solving Equations in Matrix Form
You can solve matrix equations, using Eigenanalysis or a solve block.
1. Solve the following non-linear equation:
Click to copy this expression
Click to copy this expression
2. Use the eigenvecs function to calculate the eigenvectors of matrix M:
Click to copy this expression
3. Use the eigenvals to calculate the eigenvalues of matrix M, and the diag function to place these values along the diagonal of matrix Vals:
Click to copy this expression
4. Use the Vectorization and Transpose operators to find X:
Click to copy this expression
Click to copy this expression
Click to copy this expression
5. Use the solver function Find in a Solve Block to find X:
Click to copy this expression
6. Evaluate Xsb2 or M:
Click to copy this expression
Solving for Quantities with Units
You can use solve blocks to solve for quantities with units. This example determines the velocity of flow through a straight length of pipe.
1. Define the density and permeability of the flowing substance:
Click to copy this expression
Click to copy this expression
2. Define the diameter and length of the pipe:
Click to copy this expression
Click to copy this expression
3. Define the pressure and gravitational force within the pipe:
Click to copy this expression
Click to copy this expression
Click to copy this expression
4. Find the solution for v, f, and NRe
Click to copy this expression
Was this helpful?