You can use one anonymous function (or any other function) is a second function. You simply have to call it as a function in the second function.
Try this:
Psat1 = ...
Psat2 = ...
P_x = @(x1) Psat2 + (Psat1 - Psat2)*x1;
y = @(x1) x1.*Psat1./P_x(x1);
--------------------
EDIT —
This works for me:
Psat1 = rand;
Psat2 = rand;
P_x = @(x1) Psat2 + (Psat1 - Psat2).*x1;
y1 = @(x1) x1.*Psat1./P_x(x1);
P_y = @(x1) Psat2 + (Psat1 - Psat2).*((y1(x1).*P_x(x1))./Psat1);
fplot(P_y,[0,1])
It is necessary to use Vectorization (link) in your functions when you combine them, so you do element-wise operations. (This will avoid warnings such as: ‘Function behaves unexpectedly on array inputs.’.)
Best Answer