Mercurial > hg > smallbox
annotate examples/private/iswhole.m @ 5:f44689e95ea4
(none)
author | idamnjanovic |
---|---|
date | Mon, 22 Mar 2010 10:43:01 +0000 |
parents | 7750624e0c73 |
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; |