annotate examples/private/iswhole.m @ 1:7750624e0c73 version0.5

(none)
author idamnjanovic
date Thu, 05 Nov 2009 16:36:01 +0000
parents
children
rev   line source
idamnjanovic@1 1 function z = iswhole(x,epsilon)
idamnjanovic@1 2 %ISWHOLE Determine whole numbers with finite precision.
idamnjanovic@1 3 % Z = ISWHOLE(X,EPSILON) returns a matrix the same size as X, containing
idamnjanovic@1 4 % 1's where X is whole up to precision EPSILON, and 0's elsewhere.
idamnjanovic@1 5 %
idamnjanovic@1 6 % Z = ISWHOLE(X) uses the default value of EPSILON=1e-6.
idamnjanovic@1 7
idamnjanovic@1 8
idamnjanovic@1 9 % Ron Rubinstein
idamnjanovic@1 10 % Computer Science Department
idamnjanovic@1 11 % Technion, Haifa 32000 Israel
idamnjanovic@1 12 % ronrubin@cs
idamnjanovic@1 13 %
idamnjanovic@1 14 % May 2005
idamnjanovic@1 15
idamnjanovic@1 16 if (nargin<2), epsilon = 1e-6; end
idamnjanovic@1 17 z = abs(round(x)-x) < epsilon;