0% found this document useful (0 votes)
12 views4 pages

Lab Report 08

This document outlines the implementation of Gauss elimination in MATLAB to solve systems of linear equations. It describes the two main phases of the method: forward elimination to create an upper triangular matrix and back substitution to find the solutions. The document also includes MATLAB code for performing these operations on a given set of equations.

Uploaded by

pubg pubg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

Lab Report 08

This document outlines the implementation of Gauss elimination in MATLAB to solve systems of linear equations. It describes the two main phases of the method: forward elimination to create an upper triangular matrix and back substitution to find the solutions. The document also includes MATLAB code for performing these operations on a given set of equations.

Uploaded by

pubg pubg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab 08 Gauss Elimination in MATLAB

Lab Report 08 / Assignment # 1


Objective:
Implementation of gauss elimination to find out the number of solutions by appropriate row and
column operation from upper and lower triangular matrix.

Theory:
The elimination of unknowns is used to solve a pair of simultaneous equations. The procedure
consisted of two steps:
1. The equations are manipulated to eliminate one of the unknowns from the equations. The result
of this elimination step is that we have one equation with one unknown.
2. Consequently, this equation could be solved directly and the result back-substituted into one of
the original equations to solve for the remaining unknown.
This basic approach can be extended to large sets of equations by developing a systematic scheme
or algorithm to eliminate unknowns and to back-substitute.
Gauss elimination:
It is the most basic of these schemes. This section includes the systematic techniques for forward
elimination and back substitution that comprise Gauss elimination. Although these techniques are
ideally suited for implementation on computers, some modify cations will be required to obtain a
reliable algorithm.
In particular, the computer program must avoid division by zero. The following method is called
“naive” Gauss elimination because it does not avoid this problem. Subsequent sections will deal
with the additional features required for an effective computer program.
The approach is designed to solve a general set of n equations:

As was the case with the solution of two equations, the technique for n equations consists of two
phases: elimination of unknowns and solution through back substitution.
Lab 08 Gauss Elimination in MATLAB

Forward Elimination of Unknowns.


The first phase is designed to reduce the set of equations to an upper triangular system. The initial
step will be to eliminate the first unknown, x1, from the second through the nth equations. To do
this, multiply by a21 /a11 eqn. (1) to give:

Now, this equation can be subtracted from Eq. (2) to give:

where the prime indicates that the elements have been changed from their original values. The
procedure is then repeated for the remaining equations.
Back Substitution:

Equation can now be solved for xn :

....................6

This result can be back-substituted into the (n 2 l)th equation to solve for xn21. The procedure,
which is repeated to evaluate the remaining x’s, can be represented by the following formula:

The two phases of Gauss elimination: forward elimination and back substitution. The primes
indicate the number of times that the coefficients and constants have been modified.

Now, perform the following elementary row operations till it is reduced to echelon form by:
Lab 08 Gauss Elimination in MATLAB

• Exchanging or swapping two rows


• Adding the certain multiple of one row to another row
• Multiplying a row by non-zero number
This procedure is repeated until the augmented matrix is reduced to following echelon form:

Thus, the solution of above system of linear equation is (a, b, c) i.e. x = a, y = b and z = c.

MATLAB Code:
>>C = [1 2 -1; 2 1 -2; -3 1 1]
>>b= [3 3 -6]'
>>A = [C b]; %Augmented Matrix
>>n= size(A,1); %number of eqns/variables
>>x = zeros(n,1); %variable matrix [x1 x2 ... xn] coulmn
>>for i=1:n-1
>> for j=i+1:n
>> m = A(j,i)/A(i,i)
>> A(j,:) = A(j,:) - m*A(i,:)
>> end
>>end
>>x(n) = A(n,n+1)/A(n,n)
>>for i=n-1:-1:1
>> summ = 0
>>for j=i+1:n
>>summ = summ + A(i,j)*x(j,:)
>>x(i,:) = (A(i,n+1) - summ)/A(i,i)
>>end
>>end
Lab 08 Gauss Elimination in MATLAB

Input:

Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy