fsolve in a for loop
古いコメントを表示
Hi I'm trying to minimize a function by solving for t at several different values for x1 and x2. I'm trying to do this in a loop but it doesnt seem like fsolve is able to solve my function. Is there something wrong with my syntax? Should the function be placed somewhere else? Here is the piece of code
for i=1:50
x0 = 1;
temp(i) = fsolve(@hw9,x0);
f = 760 - ((x1(i)*exp(-log(x1(i)+.5912*exp(-11.7755/(1.987*t))*x2(i))+x2(i)*(.5912*exp(-11.7755/(1.987*t))/...
(x1(i)+.5912*exp(-11.7755./(1.987*t))*x2(i))-(1.691*exp(-727.956/(1.987*t))/(1.691*exp(-727.956/(1.987*t))*x1(i)+x2(i))))))*10^(6.87987 -(1196.76/(219.161+t))))...
- (x2(i)*exp(-log(x2(i)+1.691*exp(-727.956/(1.987*t))*x1(i))-x1(i)*((.5912*exp(-11.7755/(1.987*t))...
/(x1(i)+.5912*exp(-11.7755/(1.987*t))*x2(i)))-(1.691*exp(-727.956/(1.987*t))/(1.691*exp(-727.956/(1.987*t))*x1(i)+x2(i))))*10^(7.33986 -(1482.29/(250.523+t)))))
end
I know it looks confusing but basically I am given vectors for x1 and x2 and I want to solve for t at different values of x1 and x2 by setting the function equal to zero
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!