I am unable to interpret the following command in a MATLAB code
while (fa > 0) == (fb > 0)
I thought it says: if fa>0 , fb > 0 and both are equal to each other then do some commands.
However, while running in debug mode, at I found that even then fa and fb were < 0 and not equal to each other, the commands were still executed.
May someone kindly help in correct interpretation of the command
This is the beginning of a while loop
Thanks
fa > 0returns a true/false vector for each entry, which is true iff the entry is positive.Therefore,
(fa > 0) == (fb > 0)is true iff all corresponding entries offaandfbahve the same signs.In other words, $fa = [1,-1]$ and $fb = [-1,1]$ would cause it to be false, but $fa = [-1,-1]$ and $fb = [-2,-3]$ would make it true.