Failure in initial objective function evaluation. FSOLVE cannot continue.
Afficher commentaires plus anciens
I want to use fsolve in loop so that every time 'a' change, my X(1) value change and my other values change accordingly. Can anyone help with it And Also can you plot x1 and y1? Any help would be appreciated.
function F = Sample13(X,a)
x1=X(1);
x2=X(2);
y1=X(3);
y2=X(4);
p1sat=X(5);
p2sat=X(6);
p=X(7);
t=X(8);
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
To Run Function M using this command:
fhandle=@Sample13;
for a=1:0.05:2
X0 = [0.5,0.5,0.5,0.5,200,200,101.325,333.9];
options = optimset('display','off');
X = fsolve(fhandle,X0,options);
disp(X)
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!