annotate Problems/private/iswhole.m @ 10:207a6ae9a76f version1.0

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