Fsolve- equation solved, inaccuracy [possible
Show older comments
This is my function:
function F = root3d(x, alpha_1, alpha_2, beta_a1, beta_a2, beta_c1, beta_c2, gama_1, gama_2, theta_1, theta_2)
F(1) = alpha_1*x(1) - x(7)^-2;
F(2) = 1000 - x(2) - (x(7)/(alpha_1^2));
F(3) = (x(10)*(((x(9)/x(8))*(beta_a1/(1-beta_a1)))^(1-beta_a1))/(gama_1*x(3)));
F(4) = (x(10)*(((((1-beta_a1)/beta_a1)*(x(8)/x(9)))^beta_a1)/(gama_1*x(5))));
F(5) = (x(11)*(((x(9)/x(8))*(beta_c1/(1-beta_c1)))^(1-beta_c1))/(theta_1*x(4)));
F(6) = (x(11)*(((x(8)/x(9))*((1-beta_c1)/beta_c1))^(beta_c1))/(theta_1*x(6)));
F(7) = x(7)*x(10) -x(8)*x(3)-x(9)*x(5);
F(8) = x(5)+x(6)-650;
F(9) = x(3)+x(4)-650;
F(10) = x(1)-x(10);
F(11) = x(2)-x(11);
F(12) = alpha_2*x(12) - x(18)^-2;
F(13) = 1000 - x(13) - (x(18)/(alpha_2^2));
F(14) = (x(21)*(((x(20)/x(19))*(beta_a2/(1-beta_a2)))^(1-beta_a2))/(gama_2*x(14)));
F(15) = (x(21)*(((((1-beta_a2)/beta_a2)*(x(19)/x(20)))^beta_a2)/(gama_2*x(16))));
F(16) = (x(22)*(((x(20)/x(19))*(beta_c2/(1-beta_c2)))^(1-beta_c2))/(theta_2*x(15)));
F(17) = (x(22)*(((x(19)/x(20))*((1-beta_c2)/beta_c2))^(beta_c2))/(theta_2*x(17)));
F(18) = x(18)*x(21) -x(19)*x(14)-x(20)*x(16);
F(19) = x(16)+x(17)-650;
F(20) = x(14)+x(15)-650;
F(21) = x(12)-x(21);
F(22) = x(13)-x(22)
end
And my code is this:
alpha_1 = 0.1;
beta_a1 = 0.2;
beta_c1 = 0.5;
theta_1 = 0.4;
gama_1 = 0.2;
alpha_2 = 0.1;
beta_a2 = 0.2;
beta_c2 = 0.25;
theta_2 = 0.4;
gama_2 = 0.2
x0 = [70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70];
options=optimset('disp','iter','LargeScale','off','TolFun',.001,'MaxIter',100000,'MaxFunEvals',100000);
[SS, fval, exitflag, output]=fsolve(@(x) root3d(x,alpha_1,alpha_2, beta_a1, beta_a2, beta_c1, beta_c2, theta_1, theta_2, gama_1, gama_2),x0,options);
SS
However I get this message in Matlab- Equation solved, inaccuracy possible.
The vector of function values is near zero, as measured by the value
of the function tolerance. However, the last step was ineffective.
<stopping criteria details>
Can you give me some ideas that I can try? Thanks in advance !
-Arpita
2 Comments
Matt J
on 3 Oct 2019
It doesn't appear that the thetas or gamas can have any effect on the solution. They simply scale the right hand sides of F([3:6,14;17]) which will have no effect on a set of homogeneous equations.
Arpita Nehra
on 3 Oct 2019
Accepted Answer
More Answers (2)
Alex Sha
on 5 Oct 2019
0 votes
a set of approximate solutions:
x1 0.0999971283199049
x2 -0.0143540751799935
x3 -1439252.41946883
x4 1439902.41946883
x5 -527282.99010789
x6 527932.99010789
x7 10.0001435407518
x8 -2.74840022211214E-7
x9 -1.14629426928716E-6
x10 0.0999971283124376
x11 -0.0143540751790788
x12 0.0999998530092107
x13 -2.71657239163275E-7
x14 -2444.18053646169
x15 3094.18053646169
x16 122870.151252869
x17 -122220.151252869
x18 10.0000000027164
x19 0.239014034293751
x20 0.00476269821181569
x21 0.0999998515396455
x22 -2.71660836684954E-7
1 Comment
Arpita Nehra
on 16 Oct 2019
Alex Sha
on 17 Oct 2019
0 votes
If want all are positive, refer the results follow:
x1: 0.0990335590812945
x2: 1.27592369827812E-11
x3: 650.000000000022
x4: 2.72057930783573E-10
x5: 650.000000001122
x6: 5.53147931778252E-11
x7: 10.0000000000192
x8: 0.000507814844408164
x9: 0.00101562968901066
x10: 0.0990238946721448
x11: 5.86346295731603E-21
x12: 0.099033559078221
x13: 3.9554649355099E-12
x14: 650.000000000205
x15: 8.92562451814302E-11
x16: 650.000000001166
x17: 1.17219410734425E-11
x18: 10.0000000000193
x19: 0.000507814844347538
x20: 0.00101562968902337
x21: 0.0990238946690532
x22: 6.03438668649515E-26
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!