I have implemented in Matlab a code that calculates the excess Gibbs energy for a given compound in a mixture.
The goal would be to compute the binodal curve for an ATPS system, by equaling the chemical potential of each component (3 in total) in the hypothetical top and bottom phases.
I did this by using fmincon. I fixed the polymer (PEG) concentration on the top phase and then 5 equations were solved to obtain the other 5 variables:
Sum of volume fraction top phase = Sum of volume fraction bottom phase = 1
Chemical potential i top = Chemical potential i bottom
However, every time the algorithm is run, different solutions are obtained and I think it's due to the high nonlinearity of this problem. Could you provide me a better strategy to obtain the binodal curve?