function [] =  compareSurfaces(xRange,yRange,n,f)
% compareSurfaces plots the two surfaces returned by f for comparison, 
% over the x- and y-interval specified by xRange and yRange, with 
% resolution n.
%
% INPUT: xRange (Range of x-values to plot, has form [xStart, xEnd].)
%        yRange (Range of y-values to plot, has form [yStart, yEnd].)
%        n (Resolution of plot.)
%        f (Function to plot. Must have the form [z1,z2] = f(x,y),
%           allow x and y to be matrices of coordinates, and return 
%           corresponding matrices z1 and z2 of function values.)
%
% OUTPUT: None
%

% Generate gridpoints
x = linspace(xRange(1),xRange(2),n);
y = linspace(yRange(1),yRange(2),n);
[X,Y] = meshgrid(x,y);

% Evaluate funtion at gridpoints
[Z1,Z2] = feval(f,X,Y);

% Plot first surface
c = ones(size(X));
surf(X,Y,Z1,c);

% Define the colors of the two surfaces
colormap([1 0 0; 0 0 1]);

% Plot second surface
c = zeros(size(X));
hold on;
surf(X,Y,Z2,c);

% Label axes
xlabel('x');
ylabel('y');
zlabel('z');

hold off;