Ahmed, use the following:
fhandle = @Sample13;
options = optimset('display','off','Algorithm','levenberg-marquardt');
a = 1:0.05:2;
for ii = 1:numel(a)
X0 = [0.5,0.5,0.5,0.5,200,200,101.325,333.9,a(ii)];
X = fsolve(fhandle,X0,options);
disp(X)
end
function F = Sample13(X)
x1=X(1);
x2=X(2);
y1=X(3);
y2=X(4);
p1sat=X(5);
p2sat=X(6);
p=X(7);
t=X(8);
a = X(9);
f1 = p1sat-(exp(16.59158 -(3643.31/(t -33.424))));
f2 = p2sat-(exp(14.25326 -(2665.54/(t -53.424))));
f3 = p - 101.325;
f4 = x1 - a;
f5 = x1 + x2 - 1;
f6 = y1 + y2 - 1;
f7 = (y1*p)-(x1*p1sat);
f8 = (y2*p)-(x2*p2sat);
F=[f1;f2;f3;f4;f5;f6;f7;f8];
end
Essentially, you treat a as another function input.
Best Answer