What about fzero? Your code could be structured like
p90 = ...
p9_1 = fzero(@(p) fn(p, XSteam), p90);
function Z = fn(p9_1, XSteam)
s9_1s = s8 ;
x9_1 = 0.98;
eta = ...
h8 = ...
h9_1s = XSteam('h_ps',p9_1,s9_1s);
x9_1s = XSteam('x_ps',p9_1,s9_1s);
h9_1 = XSteam('h_px',p9_1,x9_1);
Z = (h8 - h9_1)/(h8 - h9_1s) - eta;
end
View doc fzero for details on exact syntax etc of fzero.
Best Answer