When you see a line of MATLAB code you don't understand, try breaking it into pieces. If you don't understand the pieces, break them up or look in the documentation.
idx = any(possibleSol < 0) | any(imag(possibleSol) ~=0);
Breaking at the | operator gives pieces:
any(imag(possibleSol) ~= 0)
Breaking the first of those into pieces:
Do you understand piece 1 part 1? If not:
Do you understand what piece 1 part 2, calling any on piece 1 part 1, does? If not:
That tells you what piece 1 does. Do the same for piece 2, split it into parts. Then put the pieces back together: if you're not sure about the | operator: