Well, the error message is clear, the function you're passing to fzero must return a finite and real value at the starting point. It's not the case for one of your starting x1 value, hence the error.
We can't tell you which value nor the cause since we don't know the values of mes, hiz, egim. Possibly mes(ra(g))-mes(ra(g-1)) is 0 in some case, and WB ends up being Inf. You should be able to test it yourself by looking at the actual values.
In any case, your g loop will fail at the last iteration since ra(g) is not valid when g = numel(ra)+1