clc hf=504.7 hg=2706.3 h=2600 X=(h-hf)/(hg-hf)//from relation h=Xhg+(1-X)hf mprintf("X=%f",X)//ans may vary due to roundoff error