%Problem 4
%Part a
t1 = [-20:0.1:20];
t2 = [-20:0.1:20];
figure(1); colormap('gray');
mesh(t1, t2, cos(t1/3)'*cos(t2/5));
title('Problem 4 Part a')

%Part b
figure(2); colormap('gray');
mesh(t1,t2, (sin(pi*t1/3)./(pi*t1/3))'* (sin(pi*t2/5)./(pi*t2/5)));
title('Problem 4 Part b')

%Part c
%Note that the original compress function provided in the homework
%could have been used as well. Here we use the generalized version.
figure(3);
I = imread('brain.jpg');
colormap('gray');
image(I);
title('Original')
figure(4);
IL = compress2(I, 100);
colormap('gray');
image(IL);
title('Low Compression, k = 90');
figure(5);
IM = compress2(I, 30);
colormap('gray');
image(IM);
title('Medium Compression, k = 30');
figure(6);
IH = compress2(I,10);
colormap('gray');
image(IH);
title('High Compression, k = 15');
