I got it:
%this is the function i used to solve it. I'm solving it with the bisection method for numerical equations
function [c, err, yc] = bisect (f, a, b, delta)
ya = feval(f, a);
yb = feval(f, b);
if ya*yb > 0, end
max1 = 1 + round((log(b-a) - log(delta)) / log(2));
for k = 1:max1
c = (a + b) / 2;
yc = feval(f, c);
if yc == 0
a = c;
b = c;
elseif yb*yc > 0
b = c;
yb = yc;
else
a = c;
ya = yc;
end
if b-a < delta, break, end
end
c = (a + b) / 2;
err = abs(b - a);
yc = feval(f, c);
%this is the while I had to use
i = 1;
while i ~= 1001
X2L = (i-1)/1000;
F =@(T) exp(OMEGA./(R.*T).*(1+3*B-4*B.*X2L).*X2L.^2+HVAP1/R.*(1/TVAP1-1./T)).*(1-X2L)+exp(OMEGA./(R.*T)*(1+B-4*B*X2L).*(1-X2L).^2+HVAP2/R.*(1/TVAP2-1./T)).*X2L-1;
[T(i),err(i),yc(i)] = bisect(F,340,390,0.0001);
i = i+1;
end
X2L = [0:0.001:0.999];

