project
mshuaeb
EENG 4350/5340: Project 2
Assigned: June 9,2015 Due: June 23, 2015
Rules
• Use C or C++ with BLAS/LAPACK for completion of this assignment.
• Produce a LATEX-generated PDF of your report.
• Ask plenty of questions to ensure you have a good understanding of the project.
• The code (and reports) should look vastly different for different groups. Very similar code will incur a hefty penalty.
Consider the function f(t) = −t3 + 2t2 + t + 2 on the closed interval t ∈ [−2, 2].
Part 1
1. Sample f(t) to produce f(tk) where k ∈ [1, 10] ⊂ Z. The tk should be randomly chosen points on the interval [−2, 2]. Produce a table with columns tk and f(tk). Ensure that the tks are not sorted.
2. Solve the normal equations using QR decomposition and calculate the error, E. Write your approximated function, f̂1(t).
3. Solve the normal equations using the SVD and calculate the error, E. Write your approximated function, f̂2(t).
4. Plot f(t), f̂1(t) and f̂2(t) on the same plot.
Part 2
In this part we will see how additive random noise affects our solution.
1. Create a new dataset by doing the following:
• Sample f(t) to produce f(tk) where k ∈ [1, 1000] ⊂ Z. The tk should be randomly chosen points on the interval [−2, 2]. Use a different random seed than used in the previous part. • Add columns y1(tk) = f(tk) + n1(tk) and y2(tk) = f(tk) + n2(tk) where n1(t) ∼ N(0, 1) and n2(t) ∼N(0, 5) to the dataset.
2. Solve the normal equations for this new dataset. NOTE: This dataset should be solved simultaneously with 3 right hand sides.
3. Include the error in your report.
1