Solve nonlinear equation with positive solution (fsolve)

59 ビュー (過去 30 日間)
Benjamin Wodey
Benjamin Wodey 2018 年 6 月 7 日
コメント済み: Benjamin Wodey 2018 年 6 月 8 日
Hello, I would like to solve 3 non linear equation:
F(1) = 0.44*x(1) + 0.23*x(2) + 0.33*x(3) - 5140;
F(2) = 0.23*x(1) + 0.44*x(2) + 0.33*x(3) - 4970;
F(3) = 4*(0.44 + 0.23)*(x(1)*x(2)/(3*x(2)+x(1))) + 0.33*x(3) - 4380;
Here, x is 3 different young modulus and my problem is, using fsolve give me negative values... Do you know if it's possible to find positive values or should I try another way ?
Thank for yours answers
  2 件のコメント
sloppydisk
sloppydisk 2018 年 6 月 7 日
I assume you're setting each of the three expressions to zero?
Benjamin Wodey
Benjamin Wodey 2018 年 6 月 7 日
right!

サインインしてコメントする。

回答 (2 件)

sloppydisk
sloppydisk 2018 年 6 月 7 日
You can set an assumption on the equations using assume, in this case there seem to be no solutions for this problem.
x = sym('x', [3 1]);
F(1) = 0.44*x(1) + 0.23*x(2) + 0.33*x(3) - 5140==0;
F(2) = 0.23*x(1) + 0.44*x(2) + 0.33*x(3) - 4970==0;
F(3) = 4*(0.44 + 0.23)*(x(1)*x(2)/(3*x(2)+x(1))) + 0.33*x(3) - 4380==0;
assume(x>=0)
sol1 = solve(F, x)
  1 件のコメント
Benjamin Wodey
Benjamin Wodey 2018 年 6 月 8 日
okay, so maybe I have to find other equations to solve my problem
thank you for your answer

サインインしてコメントする。


Star Strider
Star Strider 2018 年 6 月 7 日
I am not certain what the values of ‘x’ should be.
Try these:
fcn = @(x) [0.44*x(1) + 0.23*x(2) + 0.33*x(3) - 5140; 0.23*x(1) + 0.44*x(2) + 0.33*x(3) - 4970; 4*(0.44 + 0.23)*(x(1)*x(2)/(3*x(2)+x(1))) + 0.33*x(3) - 4380];
[xs,fv] = fsolve(@(x) norm(fcn(x)), [1; 1; 1])
[xs,fv] = fmincon(@(x) sum(fcn(x)), [1; 1; 1], [], [], [], [], [0; 0; 0],[1; 1; 1]*Inf)
The first one provides a sort of ‘pseudo-constraint’ using the norm of the output. The second uses fmincon to constrain the parameters, however since it requires that the argument function return a scalar, leaves that as a problem for you to solve. (I arbitrarily chose to sum them here.)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by