Register to reply

Gaussian elimination in MATLAB

by aznkid310
Tags: elimination, gaussian, matlab
Share this thread:
Apr17-09, 05:09 PM
P: 109
1. The problem statement, all variables and given/known data

The point of this homework is to experiment with Gaussian elimination, and to
develop an appreciation for partial pivoting. Questions 1 & 2 can be done with a
calculator (though a computer is preferred). Question 3 requires a computer – you
do not necessarily have to write any programs: C++ examples are on the class
web page, and Matlab examples are all over the web. Use whatever you like, but
give credit to your sources.

[2.0 1:0 1:0 [ x1 [2.0 + 10e-10
1.0 10e-10 10e-10 x2 = -10e-10
1.0 10e-10 10e-10] x3] 10e-10]

Solve this equation for x using partial pivoting. Strive
to achieve the most accurate results possible (e.g., double precision). First obtain
the decomposition
then use this decomposition to determine x with two back substitution steps:
Ly = (Pb)
Rx = y

Q2) The identity matrix I can be thought of as a collection of vectors:
I = (e1e2...en)
where ei is a vector of length n that is zero, except in the ith component which is 1.

If one were to represent the inverse matrix A^-1 as a collection of vectors,
A^-1 = (

Then the ith column of A^-1 can be determined by solving Aai = ei. Or, using our
LR decomposition, LR(ai )= P(ei). Use this to find the inverse of the matrix in (1)
with P,L,R from partial pivoting. Assess the quality of the result by computing

Q3) For n = 60, solve
Ax = b
where n n matrix A is given by
Ai j =r2n + 1sin2i j2n + 1
i; j = 1 to n;

and where b is given by the n-long vector of ones. With trivial pivoting, and with
partial pivoting, calculate r = b-Ax. Present sqrt(r*r) (aka the L2 norm krk2), which
should be zero with perfect math.

2. Relevant equations

I was able to do #1 with a calculator and by hand, and I understand the basic ideas of 2 and 3, but I dont know how to implement them in MATLAB.

3. The attempt at a solution

For #1, i get
x = 4
Phys.Org News Partner Science news on
World's largest solar boat on Greek prehistoric mission
Google searches hold key to future market crashes
Mineral magic? Common mineral capable of making and breaking bonds

Register to reply

Related Discussions
MATLAB - Gaussian Elimination with Partial Pivoting Engineering, Comp Sci, & Technology Homework 0
Gaussian Elimination? Linear & Abstract Algebra 1
Gaussian Elimination Calculus 1
Gaussian Elimination Precalculus Mathematics Homework 3
Gaussian elimination Introductory Physics Homework 3