On 24-Jan-2008, Alois Schloegl wrote:
| The test is on x and the assignment in y.
Doh, I was completely missing that detail.
| So the problem is
| x = [NaN, -2, -1, 0, 1, 2];
| y = zeros(size(x));
| y(abs (x) > 1) = NaN
|
| y =
| 0 NaN 0 0 0 NaN
|
| The is no NaN in y for the case of isnan(x).
|
| The yields the (incorrect) result
| erfinv(x)
| ans =
| 0 NaN -Inf -0 Inf NaN
|
|
| The correct result should be
|
| ans =
| NaN NaN -Inf -0 Inf NaN
OK, then how about
## x(i) < -1 or x(i) > 1 or isnan (x(i)) ==> y(i) = NaN
y(abs (x) > 1 | isnan (x)) = NaN;
y(x == -1) = -Inf;
y(x == +1) = +Inf;