% a quick example to figure out what it is we're looking for...

% Colin Macdonald, 01/03/2002

clear
N = 12;

% setup an initial picture (black with a white band down the middle)
A = zeros(N,N);
A(:,(N/3+1):(2*N/3)) = 64*ones(N,N/3);

% arrays to store the results of the low and high pass filters
LP = zeros(size(A));
HP = zeros(size(A));

% use two nested loops (ugh) to perform the filters
for m = 1:N
  LP(m,1) = (A(m,1) + 0)/2;
  HP(m,1) = (A(m,1) - 0)/2;
  for n = 2:N
    LP(m,n) = (A(m,n) + A(m,n-1))/2;
    HP(m,n) = (A(m,n) - A(m,n-1))/2; 
  end  
end

% spam for yer terminal
A
LP
HP


figure(1)
clf;
subplot(2,2,1);
image(A)
xlabel('x'); ylabel('y');
title('Original');

subplot(2,2,3);
image(LP)
xlabel('x'); ylabel('y');
title('Low Pass');

subplot(2,2,4);
image(HP+32)
xlabel('x'); ylabel('y');
title('High Pass');

