I spent over an hour chasing a bug in my code which was leading to a precision error. It turned out that in one of my equations, I had forgotten to divide two vectors element-wise; I had written /
instead of ./
. Usually Matlab gives an error in these cases, e.g. if you try to multiply two vectors with *
instead of .*
. But in this case it's happily returning a scalar value! Is this supposed to happen, and does this value have any meaning?
For example,
x = 0 : 0.01 : 1;
y = x/exp(x);
sets y=0.3132
.