In your line
lnfuglm(:,:)=((bm/b(i))*(((P*vl(1,i))/(R*T))-1))-(log(((vl(1,i)-b(i))*P)/R*T))+(alpha(i)/(2*sqrt(2)*R*T))*(bm/b(i))-(((2/alpha(i))*((ym*am*alpham)+(ye*ame*alpha(i))))*(log((vl(1,i)+(1+sqrt(2))*b(i))/(vl(1,i)+(1-sqrt(2))*b(i)))));
the subexpression that dominates numerically is ye*ame*alpha(i) . ame and alpha(i) are both over 40000, so the product is fairly large; there are various scaling factors multiplied in and various additions, but the net result after everything is values below -4500 for lnfuglm . When you then exp() that on the next line, the results are all numerical 0, and those 0 carry through into the other calculations. Then your line
ymnew(i)=((xm(i)*fuglm(:,:))/(fugvm(:,:)));
involves fuglm all zero with the / matrix right division operator and fugvm all zero, which is going to give you a rank deficiency error.
Best Answer