How to solve a system of nonlinear equations with three unknowns & three equations?

3 views (last 30 days)
I tried to solve the system of nonlinear equations with fsolve function but the answers for unknowns are not true,I think there is a problem with number of iterations or the reasonable error.
How can I set these parameters?
Here are the equations:
311*cos(0.5236-x(3))+x(1)*cos(x(2)+x(3))-311=0
311*sin(.5236-x(3))-(x(1)*sin(x(2)+x(3)))=0
(x(1)^2)*(tan(.5236)*cos(x(2))*cos(x(2)-.7526)-(1/tan(.5236))*(sin(x(2))*sin(x(2)-.7526)))-7036.18=0
x(1) is a positive and x(2) and x(3) are angles then it is reasonable to be between 0 and 2pi
  5 Comments
Farid
Farid on 4 Nov 2013
Yeah, all of them are equal to zero, x(1) is a positive and x(2) and x(3) are angles then it is reasonable to be between 0 and 2pi

Sign in to comment.

Answers (2)

Matt J
Matt J on 4 Nov 2013
Edited: Matt J on 4 Nov 2013
Seems a matter of making a lucky initial guess. Here's one solution
x =
146.6872 3.9507 0.9997
Here's another
x =
592.2262 2.9287 9.3271
And another
x =
592.2262 2.9287 3.0439
  7 Comments

Sign in to comment.


Walter Roberson
Walter Roberson on 6 Nov 2013
Edited: Walter Roberson on 6 Nov 2013
x = [146.6871682461996007408428, 3.950714907905676528151964, 0.9997481449580266590840019]
To the accuracy used, this is the only solution with x(1) positive and the other two in [0, 2*Pi]
The x(1) in the 592 range (given by Matt J) appear to be false solutions.
Method of solution:
The third equation can be solved for x1 to give x1 in terms of x2.
The second equation can be solved for x3 to give x3 in terms of x2.
Substituting the x1 and x3 terms into the first equation gives an equation in terms of x2 only. This equation goes imaginary for some values of x2 in [0, 2*Pi] . By examining the plot, you can see that there is a single 0 crossing, somewhere near x2 = 5*Pi/4. You can use fzero() or equivalent to find the x2 for which the equation becomes 0.
Then, with the numeric x2 in hand, you can substitute into the two previous forms to get x1 and x3. Although there is an arctan() involved, there is only one solution that works.
  4 Comments
Farid
Farid on 7 Nov 2013
these equations are not completely true and maybe the some coefficients should be changed,I'm looking for a general solution for these equation in MATLAB codes
Walter Roberson
Walter Roberson on 8 Nov 2013
Your equations involve the values 0.5236 and 0.7526 . Is there a formula that relates those two values? If I replace 0.5236 with the symbol alpha, then can 0.7526 be expressed in terms of alpha, or is it an independent variable?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!