Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
EnglishTI_MZ_CAPR(1ea429)2010.doc
Скачиваний:
17
Добавлен:
28.04.2019
Размер:
2.77 Mб
Скачать

Laboratory work №3 Solution system of Linear Algebraic Equations

3.1 Purpose of the work

This laboratory work helps students a)study of direct and iterativ methods for solving system of linear algebraic equations; b) the use of MATLAB for solving system of linear algebraic equations.

3.2 Tasks for laboratory work

  1. To study the direct and iterative methods(Jacobi and Zejdel) for solving nonlinear equations.

  2. Make a programs-functions to find the roots of the Jacobi and Zejdel methods.

  3. To carry out the individual task.

  4. Save results of the work (the programs,listing of calculation) at your personal files.

  5. Draw up report.

3.3 The basic theoretical knowledge

A set of linear algebraic equations looks like this:

(3.1)

Here the n unknown xj , j=1, 2, … , n are related by m equations. The coefficients aij with i= 1, 2, … , m and j = 1, 2, … , n are known numbers, as are the right-hand side quantities bi , i =1, 2, …, m.

The set of numbers is called the solution of system (3.1) if their substitution x1 , x2 , …, xn in the equation terns the equations into identities.

3.3.1 Direct methods

Requirements for a Solution

If an exact solution to Ax = b exists, b must lie in the column space of A. If it does, then the system is said to be consistent(совместная). If the system is consistent, an exact solution exists.

Matlab’s function rank(A) gives the number of linearly independent columns in A.

If given the n-by-n matrix A and the n-by-1 vector, b

• the solution to Ax = b exists and is unique for any b if and only if rank(A) = n.

• rank(A) = n automatically guarantees that the system is consistent.

Cramer’s formulas

If D = det A  0, the system of linear equations (3.1) only has one solution and that it can be found by Cramer’s formulas. But, the calculation of these formulas requires the very large number of operations, therefore Cramer’s formulas is used only for systems with n not higher 3:

, i = 1, 2, … , n.

The method of inverse matrix

The system of equations (6.1) can be written in matrix-vector form:

Ax = b (3.2)

Here x = ( x1 , x2 , …, xn ) is a vector whose coordinates x1 , x2 , …, xn are the sought-for unknowns, b = ( b1 , b2 , …, bn ) is a vector whose coordinates are free terms of system (6.1) and A is the matrix of coefficients of the system. The left-hand side of (3.2) is the result of multiplying matrix A by column vector x (that is, by a one column matrix); hence (3.2) equates the vectors Ax and b and is equivalent to the system of n equalities between the coordinates of the vectors. Thus, we arrive the following problem: given a matrix A and a column vector b, find a column vector x such that Ax = b.

The inverse of a square matrix A is a matrix A-1 such that A-1 A = E, where E is unit matrix.

Theorem. Given that det A  0, the solution to a system of equations Ax = b is unique and has the form

x = A-1 b (3.3)

where A-1 is the inverse of the matrix A.

Note that inverse matrices are especially suitable when we have to solve several systems of equations with the same left-hand sides but different columns of free terms. Indeed, the main difficulty in solving a system of linear equations using an inverse matrix is to compute the inverse matrix itself.

The method of Gauss

In general terms, this method consists in successive elimination of the unknowns from the equations of system (3.1). The matrix (3.4) will be called the augmented matrix of system (3.1); the augmented matrix differs from the matrix of system by the additional (last) column, which is formed from the free terms of the system.

(3.4)

Gaussian elimination involves the transformation of successive matrices using the elementary transformations of a matrix ( according the rules for transforming matrices) to yield a matrix of the form:

From last equation we find xn =dn /cnn , …, x1 = d1 –c12 x2 - … -c1n xn.

Solving systems of equations with MATLAB

Example 3.1. Electric circuit. . .

Apply Kirchhoff's voltage law for each loop and charge conservation at the nodes:

In matrix-vector form:

Solve a system of linear equations,

Ax = b

Here A is a known n-by-n, nonsingular matrix, (its determinant is not equal to zero); b is an n-by-1 known column vector; and x is an n-by-1 column vector of unknowns.

Let R1=1, R2=1, R3=4, R4=3, R5=1, E1=41, E2=38.

Using the capabilities of MatLab for solving systems of linear algebraic equations by direct methods (Gauss, Inverse Matrix, Cramer's rule) to find the currents i1, i2, i3, i4, i5.

Gaussian elimination:

The matrix A is square (m = n) and nonsingular (det(A) <> 0):

This numerical technique is similar to the way you are used to when solving systems, i.e., elimination and substitution. In MATLAB this is done with the left division operator (\): x = A\b

>> A=[1 0 0 3 0

0 1 0 -3 1

0 0 -4 0 1

1 -1 0 -1 0

0 1 -1 0 -1]

>> V=[41;0;38;0;0]

>> i=A\V

i =

17.0588

9.0784

-5.7843

7.9804

14.8627

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]