Solving Linear Equations with matlab - tutorial 1 | applied electronics engineering

Latest

Solving Linear Equations with matlab - tutorial 1

By Applied Electronics - Saturday, February 4, 2017 No Comments
Solving Linear Equations with Matlab is simply and easy. Matlab was specifically build with Matrix form of mathematics in mind. Furthermore, Matlab has many functions and operators that makes it easy to solve system of linear equations and eigenvalue problems.

Why we need to learn system of linear equations and eigenvalue problems? It is important to learn these mathematical equations and expression because most physical systems can be modeled and described by system of linear equations.

As an example of describing physical system in terms of system of linear equations, consider a electrical network.

Solving Linear Equations with matlab - tutorial 1

What are the values of the currents I1, I2, I3 and I4 in the circuit?

There are couples of methods we could use to answer this question. However it is easily formulated in terms of system of linear equations.

From Ohms law,

 From Kirchhoff Voltage Law, for loop abcd in the figure above we obtain,
Substituting known voltages we further obtain,
If we do this for the four loops then we obtain the system of linear equations as follows:


Given that,
Substituting these values we then obtain,





We can rewrite these equations in Matrix form,

Solving Linear Equations with matlab - tutorial 1
This form describes the system of linear equations in matrix form. A shorthand notation usually used is,


Ax = b

This equation is also called eigenvalue equation and problem to solve for the variable such as current I in this case is called eigenvalue problem.

Example of Solving Linear Equations with Matlab 

Solving Linear Equations with Matlab is now illustrated for this problem. Now the above system of linear equation in the matrix form can be conveniently solved for the four current values in just few clicks in Matlab.

>> A = [4 -2 0 0;-2 6 -2 0;0 -2 6 -2;0 0 -2 8];
>> b = [5 0 0 0].
;
>> A\b
ans =
1.5426
0.5851
0.2128
0.0532

In this way you can use Matlab for solving linear equations with matlab. In next blog post we explain Consistent and Inconsistent Linear Inhomogeneous Equations.

If you like it share it. Also subscribe to our blog.

No Comment to " Solving Linear Equations with matlab - tutorial 1 "