Docsity

3 Problems in Project 2 - Application Linear Algebra Fall 2008 | MATH 401, Study Guides, Projects, Research of Linear Algebra

Toggle sidebar
bg1
Math 401 - Section 0301 - Fall 2008 Instructor: Ricardo H. Nochetto
MATLAB Project # 2 – Due Date: 11/25/2008
You must work each problem in a separate M-file and hand in a printout of the diary file of each problem.
The homework is due before Thanksgiving.
Problem 1 (30 pts) Data Fitting. The following data are the US census for the population (in millions) in
the USA between 1900 and 1990:
1900 1910 1920 1930 1940
75.995 91.972 105.711 123.203 131.669
1950 1960 1970 1980 1990
150.697 179.323 203.212 226.505 249.633
Proceed as follows to find the least squares fit p(t) = α0+α1t+α2t2+α3t3to the given table using MATLAB.
(a) Determine the rectangular matrix Aand right-hand side bof the least squares problem.
(b) Form and solve the Normal Equations. Use the commands A’ to transpose Aand \to solve the linear
system by Gaussian elimination. Plot the table and p(t) for 1900 ≤t≤1990 together.
(c) Show that ATAis symmetric and positive definite, that is xTATAx>0 for all x∈Rn, provided Ais
full rank (A∈Rm×nwith n≤m). Use the command rank(A) to find the rank of Aof (a). Compute the
Cholesky decomposition of ATA, using the command R = chol(A’*A) (see Olver-Shakiban p.168), and then
solve by backward and forward substitution (use the command \).
(d) Find the QR factorization of Awith the commands [Q,R]=qr(A) and solve the least squares problem.
Plot the table and p(t) for 1900 ≤t≤1990 together.
Problem 2 (30 pts) Data Fitting and Orthogonal Polynomials. This problem repeats Pb#1 but replacing
the canonical basis {1, t, t2, t3}of P3by orthogonal polynomials.
(a) Obtain orthogonal polynomials {p1(t)}3
i=0 with respect to the scalar product hp, qi=Rb
ap(t)q(t)dt
where a= 1900 and b= 1990. Determine by hand the first four Legendre polynomials on the interval
[−1,1] by means of the Gram-Schmidt orthogonalization procedure, and then transform them to the interval
[1900,1990] by the simple change of variables x= (t−1945)/45. Explain why the resulting polynomials are
still orthogonal.
(b) Repeat Pb#1 (b). Use the command cond(A’*A) to find the condition number of ATAand compare
with that in Pb#1(b) (recall ML#1-Pb3(c) for the meaning of cond). Draw conclusions.
(c) Repeat Pb#1 (d).
Problem 3 (40 pts) Fast Fourier Transform and Denoising. This problem shows how a noisy signal can be
transformed to the frequency domain via the Fast Fourier Transform (FFT), clean via thresholding of the
smallest coefficients, and transform back to obtain a signal with less noise.
(a) Given the equally spaced 28sampling points x = [1:256]*2*pi/256 in the interval [0,2π], consider
the function values y = sin(5*x) and the noisy function values z = sin(5*x) + 0.1*randn(256,1)’.
The command randn(256,1) generates a normal distribution of 256 random numbers with zero mean and
variance one. Use plot(x,y,x,z) to plot both functions.
(b) Compute f = fft(z). Write a MATLAB function t = thresh(f,a) which computes the modulus of
each component of fusing the commands conj and sqrt, and then zeros all entries with values < a.
(c) Compute s = ifft(t), the inverse FFT of t, for a=2,3,4. Plot the three cases using plot(x,s)
and draw conclusions.

Partial preview of the text

Download 3 Problems in Project 2 - Application Linear Algebra Fall 2008 | MATH 401 and more Study Guides, Projects, Research Linear Algebra in PDF only on Docsity!

Math 401 - Section 0301 - Fall 2008 Instructor: Ricardo H. Nochetto

MATLAB Project # 2 – Due Date: 11/25/

You must work each problem in a separate M-file and hand in a printout of the diary file of each problem. The homework is due before Thanksgiving.

Problem 1 (30 pts) Data Fitting. The following data are the US census for the population (in millions) in the USA between 1900 and 1990:

1900 1910 1920 1930 1940

  1. 995 91. 972 105. 711 123. 203 131. 669

1950 1960 1970 1980 1990

  1. 697 179. 323 203. 212 226. 505 249. 633

Proceed as follows to find the least squares fit p(t) = α 0 +α 1 t+α 2 t^2 +α 3 t^3 to the given table using MATLAB.

(a) Determine the rectangular matrix A and right-hand side b of the least squares problem.

(b) Form and solve the Normal Equations. Use the commands A’ to transpose A and \ to solve the linear system by Gaussian elimination. Plot the table and p(t) for 1900 ≤ t ≤ 1990 together.

(c) Show that AT^ A is symmetric and positive definite, that is xT^ AT^ Ax > 0 for all x ∈ Rn, provided A is full rank (A ∈ Rm×n^ with n ≤ m). Use the command rank(A) to find the rank of A of (a). Compute the Cholesky decomposition of AT^ A, using the command R = chol(A’*A) (see Olver-Shakiban p.168), and then solve by backward and forward substitution (use the command ). (d) Find the QR factorization of A with the commands [Q,R]=qr(A) and solve the least squares problem. Plot the table and p(t) for 1900 ≤ t ≤ 1990 together.

Problem 2 (30 pts) Data Fitting and Orthogonal Polynomials. This problem repeats Pb#1 but replacing the canonical basis { 1 , t, t^2 , t^3 } of P^3 by orthogonal polynomials.

(a) Obtain orthogonal polynomials {p 1 (t)}^3 i=0 with respect to the scalar product 〈p, q〉 =

∫ (^) b a p(t)q(t)dt where a = 1900 and b = 1990. Determine by hand the first four Legendre polynomials on the interval [− 1 , 1] by means of the Gram-Schmidt orthogonalization procedure, and then transform them to the interval [1900, 1990] by the simple change of variables x = (t − 1945)/45. Explain why the resulting polynomials are still orthogonal.

(b) Repeat Pb#1 (b). Use the command cond(A’*A) to find the condition number of AT^ A and compare with that in Pb#1(b) (recall ML#1-Pb3(c) for the meaning of cond). Draw conclusions.

(c) Repeat Pb#1 (d).

Problem 3 (40 pts) Fast Fourier Transform and Denoising. This problem shows how a noisy signal can be transformed to the frequency domain via the Fast Fourier Transform (FFT), clean via thresholding of the smallest coefficients, and transform back to obtain a signal with less noise.

(a) Given the equally spaced 2^8 sampling points x = [1:256]2pi/256 in the interval [0, 2 π], consider the function values y = sin(5x) and the noisy function values z = sin(5x) + 0.1*randn(256,1)’. The command randn(256,1) generates a normal distribution of 256 random numbers with zero mean and variance one. Use plot(x,y,x,z) to plot both functions.

(b) Compute f = fft(z). Write a MATLAB function t = thresh(f,a) which computes the modulus of each component of f using the commands conj and sqrt, and then zeros all entries with values < a.

(c) Compute s = ifft(t), the inverse FFT of t, for a = 2, 3, 4. Plot the three cases using plot(x,s) and draw conclusions.