# Facing problem in solving simultaneous nonlinear equation with 3 unknowns

3 views (last 30 days)

Show older comments

x = optimvar('x',3);

eq1 = 0.7133/(1-0.7133)== x(1).*(1-exp(-(1-x(1)).*127./x(2))).*exp(-127/x(3))/(1-x(1));

eq2 = 0.8058/(1-0.8058)== x(1).*(1-exp(-(1-x(1)).*229./x(2))).*exp(-229/x(3))/(1-x(1));

eq3 = 0.7133/(1-0.8708)== x(1).*(1-exp(-(1-x(1)).*421./x(2))).*exp(-421/x(3))/(1-x(1));

prob = eqnproblem;

prob.Equations.eq1 = eq1;

prob.Equations.eq2 = eq2;

prob.Equations.eq3 = eq3;

show(prob)

x0.x = [0.9 410 8000];

[sol,fval,exitflag] = solve(prob,x0);

disp(sol.x)

Here is my codes and error popout. I cant get the correct ans

Hope other can help me :) thanks in advance

##### 3 Comments

John D'Errico
on 4 Dec 2023

### Answers (1)

Matt J
on 4 Dec 2023

Edited: Matt J
on 4 Dec 2023

What @Dyuman Joshi says is true. However, your equations don't seem to make sense without upper and lower bounds on x. For example, since you are dividing by x(2) and x(3) in certain places, you are clearly assuming them to be bounded away from zero somehow... When I impose bounds, a solution (least squares only) is found without hitting the iteration limit.

x = optimvar('x',3,'Lower',[0,0,0],'Upper',[1,inf,inf]);

eq1 = 0.7133/(1-0.7133)== x(1).*(1-exp(-(1-x(1)).*127./x(2))).*exp(-127/x(3))/(1-x(1));

eq2 = 0.8058/(1-0.8058)== x(1).*(1-exp(-(1-x(1)).*229./x(2))).*exp(-229/x(3))/(1-x(1));

eq3 = 0.7133/(1-0.8708)== x(1).*(1-exp(-(1-x(1)).*421./x(2))).*exp(-421/x(3))/(1-x(1));

prob = eqnproblem;

prob.Equations.eq1 = eq1;

prob.Equations.eq2 = eq2;

prob.Equations.eq3 = eq3;

x0.x = [0.9 410 8000];

[sol,fval,exitflag,output] = solve(prob,x0);

disp(sol.x)

exitflag,output

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!