
AOE/ESM 2074
Introduction to Computational Methods
due 12 October 2000
1. Read the remainder of Chapter 5 in the Chapman text.
2. Complete the Matlab function lsolve.m by providing the backward substitution part
of the code.
3. Write a Matlab code segment that will identify rows for the interchange step in the
Gaussian elimination. More specifically, suppose at some point we have processed
through row kk −1 so that the diagonal element aa(kk −1,kk−1) is unity and the
elements in the kk −1 column below it are all zero. Prior to processing row kwe want
to consider a row interchange. For this purpose we want to identify the row from kk to
the end that has the largest element (absolute value) in the current column kk.You
are to provide the code that returns this row index.
4. You are given an array x(n x 1 ) of independent variables and a corresponding array
yof dependent variables. We expect that there is a linear relation
yı=mxı+b
that approximates this data. You are to determine a least squares estimate for mand
b. Specifically, consider the problem of finding mand bto minimize the fit error
E(m, b)=
n
ı=1
(yı
−mxı+b)2
Analyze this problem and describe a way to calculate mand bgiven the data. Write a
Matlab function that will accept arrays xand yas input and compute the corresponding
mand bvalues.
1