0% found this document useful (0 votes)
2 views

HW4

The document outlines Homework 4 for AOE 5404, focusing on denoising a noisy function using least squares. It includes steps for sampling a function, formulating a minimization problem, and constructing a linear system to solve it, with specific instructions for using MATLAB or Python. Students are required to analyze the results of different smoothing factors and discuss their findings.

Uploaded by

celin
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)
2 views

HW4

The document outlines Homework 4 for AOE 5404, focusing on denoising a noisy function using least squares. It includes steps for sampling a function, formulating a minimization problem, and constructing a linear system to solve it, with specific instructions for using MATLAB or Python. Students are required to analyze the results of different smoothing factors and discuss their findings.

Uploaded by

celin
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/ 2

AOE 5404 Homework 4

Due on Feb. 19, 2025


Problem 1 [5 pts]: Denoising using least squares.
Consider a “noisy” function
𝑓𝑓 (𝑥𝑥 ) = 𝑥𝑥 cos(𝑥𝑥 ) + 𝜀𝜀
for 0 ≤ 𝑥𝑥 ≤ 2𝜋𝜋. Here 𝜀𝜀 is a continuous uniform random variable between 0 and 1 (i.e. the “noise”).
(1) Sample the interval 0 ≤ 𝑥𝑥 ≤ 2𝜋𝜋 using 401 points, uniformly distributed (i.e. with Δ𝑥𝑥 = 𝜋𝜋/200). Let 𝒙𝒙 ∗ be a
column vector that stores these sample points, and 𝒚𝒚∗ = 𝑓𝑓 (𝒙𝒙∗ ). Plot (𝒙𝒙∗ , 𝒚𝒚∗ ). You should observe a noisy curve.
Hint: You can use “rand” in MATLAB or “numpy.random.rand” in Python to generate uniformly distributed
random numbers.

The objective of “denoising” can be stated as finding a vector 𝒚𝒚 that is “similar” to 𝒚𝒚∗ , but smoother.
Mathematically, this objective can be formulated as
min 𝜑𝜑 (𝒚𝒚),
𝒚𝒚

where
𝑛𝑛−1

𝜑𝜑 (𝒚𝒚) = ‖𝒚𝒚 − 𝒚𝒚∗ ‖22 + 𝜇𝜇 � (𝑦𝑦𝑖𝑖+1 − 𝑦𝑦𝑖𝑖 )2 .


𝑖𝑖 =1

Here 𝑛𝑛 denotes the number of sample points (401 in this example), and 𝜇𝜇 is a “smoothing” factor. You should
realize that the first term of 𝜑𝜑(𝒚𝒚) enforces that 𝒚𝒚 is close to 𝒚𝒚∗ , while the second term enforces that 𝒚𝒚 is smoother
(depending on the value of 𝜇𝜇).
(2) Show that the above minimization problem can be formulated as a least squares problem. That is, find matrix 𝑨𝑨
and vector 𝒃𝒃, such that
𝜑𝜑 (𝒚𝒚) = ‖𝑨𝑨𝑨𝑨 − 𝒃𝒃‖22 .
What are the dimensions of matrix A? Is it a sparse matrix? Hint: 𝑨𝑨 does not need to be a square matrix.
(3) Show that minimizing ‖𝑨𝑨𝑨𝑨 − 𝒃𝒃‖22 is equivalent to solving linear system
𝒓𝒓
� 𝑰𝑰𝑻𝑻 𝑨𝑨� � � = �𝒃𝒃�.
𝑨𝑨 𝟎𝟎 𝒚𝒚 𝟎𝟎
Realize that this linear system preserves sparsity if 𝑨𝑨 is a sparse matrix.
(4) Construct this linear system for the current problem, calculate its condition number, and solve it using either a
program you developed in previous homework or a built-in function. Try 𝜇𝜇 = 0, 1, 100, 1000, 10000. In each
case, plot your solution 𝒚𝒚 in the same graph with 𝒚𝒚∗ . Discuss your results for different values of 𝜇𝜇.
(ref. solution, 𝜇𝜇 = 100)
(In the same way, least squares can be applied to denoise and deblur 2D images.)

You might also like