The ability to solve multi-variable linear equations is essential in engineering. While there are many tools that allow you to do this: handwritten procedures, calculators, etc., this treatment will describe the utilization of MATLAB. While there is no proficiency in MATLAB required, it will be assumed that the user is familiar with linear systems of equations and their applications. For the purpose of demonstration, we will solve a system with 3 variables.

__Procedure__

The 3 equations we will be solving are:

x - 3y + 3z = -4

2x + 3y –z = 15

4x – 3y –z = 19

1. We need to enter the coefficients of our 3 variables into MATLAB in matrix form. To do this, type:

A = [1 -3 3 ; 2 3 -1 ; 4 -3 -1]

MATLAB will return:

A =

1 -3 3

2 3 -1

4 -3 -1

Confirm that you have entered the values correctly.

2. Now we will enter the solutions of our 3 equations into a single column vector. Type:

b = [ -4 15 19] ; b = b’

MATLAB returns:

b =

-4

15

19

Again, confirm that you have entered the values correctly.

3. Finally, we will solve our equations algebraically by dividing the constant “b” matrix by the coefficient “A” matrix. In matrix algebra, there is no division. Instead, we multiply by the inverse. This is done by typing:

x = inv(A)*b

Matlab returns the solution:

x =

5.0000

1.0000

-2.0000

This is interpreted as:

x = 5

y = 1

z = -2

## Discussions

4 years ago on Introduction

So simple! I love it! Thanks for sharing!