Unit# 9- MATLAB 2 | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
A great number of engineering problems require the solution of a system of linear equations. These systems may consist of 3 4 equations or may be comprised of hundreds of equations. We have all seen some linear systems in arithmetic, high school algebra and pre calculus courses. A four by four system looks like this: a11 x1 + a12 x2 + a13 x3 + a14 x4 = b1 a21 x1 + a22 x2 + a23 x3 + a24 x4 = b2 a31 x1 + a32 x2 + a33 x3 + a34 x4 = b3 a41 x1 + a42 x2 + a43 x3 + a44 x4 = b4 Here the a’s and the b’s are known numbers and the x’s are the unknowns to be determined by the solution of the system. The reason these equations are called “linear” is that the unknowns appear only in the first power: no square, no powers, no transcendental functions like sin (x2) or e x1. The following table gives a few examples of engineering problems that require the solution of linear systems.
Writing a system in terms of arrays. When we look at the system given at the top of this file, it is evident that the x’s are needlessly repeated in each line of the system. It makes a lot of sense to develop some sort of notation, which will eliminate the need to write them again and again in each of the equations. This notation is supplied by the introduction of a new array operation known as matrix multiplication. Let us first consider a simple example: We have a 3X4 matrix A and a 4X1 matrix B defined as: . The product of the two matrices , noted as AB is another matrix C having 3 rows and 1 column. The elements of this matrix C are obtained by adding the products of the numbers in the rows of A with the numbers in the column of matrix B. This is what we get:
As we can see, for this definition to make sense, the number of columns of the first matrix must match the number of rows of the second matrix. It also implies that the resulting matrix C will have the same number of rows as the first matrix and the same number of columns as the second matrix i.e. ( M X N ) ( N X K ) à ( M X K ) When the second matrix has more than one columns, then we multiply each of its columns with the first matrix as shown above for the single column. This is a more general example:
Of course, MATLAB is very good at matrix multiplication. All we have to do is define the arrays and then write A * B. Here is the above example worked by MATLAB:
In order to write our linear system of equations in matrix notation, we need one more concept. This is the concept of equality of matrices. When we write A = B and a, b are matrices we imply the following: 1) both matrices have the same number of rows and the same number of columns 2) each and every element of matrix A is equal to the corresponding element of the matrix B. Example: implies that a = 3, b = 5, c = 1, and d = 7. We are now ready to write our system in matrix form, we write A x = B Where Note that matrix names are usually written with bold face letters or with an ~ underline. |
||||||||||||||
Jacob
Y. Kazakia © 2001 All rights reserved |