There is one thing about Matlab that I don't like: it sometimes tries to be too smart. For example, if I have a negative square root, for example
a = -1; sqrt(a)
Matlab does not throw an error, but silently switches to complex numbers. The same thing happens with negative logarithms. This can make it difficult to find errors in a more complex algorithm.
A similar problem is that Matlab "resolves" silent, non-quadratic linear systems, as in the following example:
A=eye(3,2); b=ones(3,1); x = A \ b
Obviously, x does not satisfy A*x==b (instead, it solves the least-square problem).
Is it possible to disable these features, or at least allow Matlab to print a warning message in this case? This helps a lot in many situations.
Boris source share