% TOLEQ
%
% Function to compare matrices allowing for a small error tolerance
%
% Usage:  result = toleq(a,b,tol)
% Where:  a and b are matrices to compare
%         tol is the magnitude of error tolerated between elements 
%             of a and b (say .00000001).
%
%         result = 1  if a and b are within tolerance
%                = 0  if any element of a and b differ by more than tol

function result = toleq(a,b,tol)
result = all(abs(a-b)<tol);
if result
    disp('TRUE');
else disp('FALSE');
end
