idamnjanovic@10: function z = iswhole(x,epsilon) idamnjanovic@10: %ISWHOLE Determine whole numbers with finite precision. idamnjanovic@10: % Z = ISWHOLE(X,EPSILON) returns a matrix the same size as X, containing idamnjanovic@10: % 1's where X is whole up to precision EPSILON, and 0's elsewhere. idamnjanovic@10: % idamnjanovic@10: % Z = ISWHOLE(X) uses the default value of EPSILON=1e-6. idamnjanovic@10: idamnjanovic@10: idamnjanovic@10: % Ron Rubinstein idamnjanovic@10: % Computer Science Department idamnjanovic@10: % Technion, Haifa 32000 Israel idamnjanovic@10: % ronrubin@cs idamnjanovic@10: % idamnjanovic@10: % May 2005 idamnjanovic@10: idamnjanovic@10: if (nargin<2), epsilon = 1e-6; end idamnjanovic@10: z = abs(round(x)-x) < epsilon;