Illustration of Matrix solutions:
For illustration, consider the three equations below with 3unknowns x_{1},x_{2}, and x_{3}:
We can write this in the form Ax = b here A is a matrix of the coefficients, x is the column vector of the unknown x_{i}, and b is the column vector of values on the right-hand side of the equations:
The solution is then x = A^{-1} b. In a MATLAB there are two easy ways to solve this. The built-in function inv is used to get the inverse of A and then multiply this by b, or use the divided into operator.
>> A = [4 -2 1; 1 1 5; -2 3 -1];
>> b = [7;10;2];
>> x = inv(A)*b
x =
3.0244
2.9512
0.8049
>> x = A\b