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