This is a continuation of my previous post, in which we learned how to find out roots of any equation using MATLAB. In this post, we will try to solve a system of equations. In Engineering, we frequently encounter with such problems in which we have to solve system of equations.
One of the easiest ways to solve system of equations is ‘The Matrix Inverse Method’.
Suppose we are given the following equations.
Let’s take a practical example related to electrical engineering.
Suppose you are given the following circuit and you are asked to calculate the current through all the resistance.
Our first step is to find out the equations using KCL and KCL. I assume that you know how to use KCL and KCL to find the equations. Using KCL and KCL, we have
MATLAB has built-in function to calculate the inverse of a matrix. Using this function, we can easily calculate the required unknowns buy simple matrix multiplication of Inverse of A and b.
Here a code for you guys: