Mercurial > hg > smallbox
annotate Problems/private/iswhole.m @ 40:6416fc12f2b8
(none)
author | idamnjanovic |
---|---|
date | Mon, 14 Mar 2011 15:35:24 +0000 |
parents | 207a6ae9a76f |
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; |