Solve nonlinear equation with positive solution (fsolve)
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
sloppydisk
el 7 de Jun. de 2018
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)
Star Strider
el 7 de Jun. de 2018
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.)
0 comentarios
Ver también
Categorías
Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!