How to judge whether two whatever is equal? alphat and alpha are two kind big vectors. Why it turns 0, which means they are not equal?
$\endgroup$ 21 Answer
$\begingroup$Floating point numbers are notoriously difficult to compare with eq(), == or any other direct bitwise comparison. This is because finite precision arithmetic rarely allows us to compute exact values. If two different algorithms compute the same result differently, it is nearly guaranteed that the numerical result will differ by some small amount.
Your best bet is to do an "almost equals" comparison:
epsilon = 1e-8; % Or some other suitably small number
if abs(alphat(16108)-alpha(16108)) < epsilon
.... % equality is met
end $\endgroup$