Assignment #4
- Assignment Problems
(Click on the link to view PDF):
- Sample Codes and Illustration :
-
Download and run the Matlab codes in
http://www.cse.ucsc.edu/~hongwang/Codes/Find_period
Learn how to use the golden search method combined with the
cubic spline interpolation to find the period
of a function when the function is known only on a set of
data points.
-
Download and run the Matlab codes in
http://www.cse.ucsc.edu/~hongwang/Codes/Dist_to_trajectory
Learn how to use the golden search method combined with the
cubic spline interpolation to find the distance from a point
to a trajectory where the trajectory is only described by
N data points.
-
Download and run the Matlab codes in
http://www.cse.ucsc.edu/~hongwang/Codes/Least_square
Try to see how the codes work and learn how to use the least square
method to fit a linear combination of a set of given functions to
the data.
"LSd5_sc1.m" fits q1(x) = b1+b2*sin(x)+b3*cos(x) to data5.txt.
"LSd5_sc2.m" fits q2(x) = b1+b2*sin(x)+b3*cos(x)+b4*sin(2*x)+b5*cos(2*x)
to data5.txt.
"LSd6_p2.m" fits p2(x) = b1+b2*x+b3*x^2 to data6.txt.
-
Download and run the Matlab codes in
http://www.cse.ucsc.edu/~hongwang/Codes/FFT_applications
Try to see how the codes work and learn how to use "fft" and "ifft"
in Matlab.
"data_compression.m" shows that a smooth function can
be very well approximated by a small fraction of Fourier modes.
"noise_removal.m" uses the Fourier transform
and a filter to remove noise from the data.
"heat_equation.m" uses the Fourier transform to
solve the heat equation.
-
Computer demonstration of implementing FFT
http://www.cse.ucsc.edu/~hongwang/Codes/FFT_implement
-
Computer demonstration of image compression
http://www.cse.ucsc.edu/~hongwang/Codes/Image_compression
"demo_grayscale.m" demonstrates the effect of image compression
on a grayscale image. "demo_color.m" demonstrates the effect of
that on a color image. Image compression is achieved by
storing only those Fourier coefficients that are larger than
a threshold. Fourier coefficients that are smaller than the
threshold are set to zero.
The compression method used here is very rudimentary. The JPEG compression
uses the same principle but a more sophisticated implementation.