Code covered by the BSD License  

Highlights from
Kinematics Toolbox

image thumbnail
from Kinematics Toolbox by Brad Kratochvil
The kinematics toolbox is intended for prototyping robotics and computer vision related tasks.

isequalf(a, b, thresh)
function [b] = isequalf(a, b, thresh)
%ISEQUALF  Returns true if the two quantities are equal within a threshold
%
%	t = ISEQUALF(A, B)
%	[t reason] = ISEQUALF(A, B, THRESH)
%
% This function is useful for floating point values, where there may be
% a small difference.
%
% See also: ISEQUAL.

% $Id: isequalf.m,v 1.1 2009-03-17 16:40:18 bradleyk Exp $
% Copyright (C) 2005, by Brad Kratochvil

if isa(a, 'sym') || isa(b, 'sym'),
  b = isequal(a,b);
else

  if 2 == nargin,
    thresh = eps()*100; % it's machine dependent now
  end

  m = max(abs(a-b));

  if any(m > thresh)
    b = false;
  else
    b = true;
  end

end

Contact us at files@mathworks.com