Solve nonlinear equation with positive solution (fsolve)

조회 수: 60 (최근 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?

댓글을 달려면 로그인하십시오.

답변 (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 CenterFile Exchange에서 Solver 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