"According to what I learned the operation of == should be implemented on the same size subjecs, eg. scalar==scalar or vector==vector..."
Not according to the MATLAB documentation. In the eq help it states "Numeric or string inputs A and B must either be the same size or have sizes that are compatible (for example, A is an M-by-N matrix and B is a scalar or 1-by-N row vector). For more information, see Compatible Array Sizes for Basic Operations". When you follow the link in the help it takes you to a page that applies to many mathematical operations, and explains, together with examples, what (different) sizes the inputs arrays can have.
"I specially can't understand what the mid-term Ymin*(x==x) mean"
So try it yourself, take it apart and see what the different parts do. Essentially x==x produces an array the same size as x, but with all values 1 (or true), and then multiplies these ones with Ymin. For example:
>> x = [4,5,6,7];
ans = 1 1 1 1
ans = 7 7 7 7
You could easily have tried that yourself at the command line. Experimenting is a great way to learn things!
Personally I would have made this a bit more explicit:
Note that the "compatible array sizes" behavior changed significantly with MATLAB version R2016b, so you should always check the documentation for your installed MATLAB, not just the publicly accessible online help (which is for the most recent version):