How to solve non linear equations with two unknowns?

10 views (last 30 days)
Kindly help me solving these equations
eqn1 = -(49*sin(x1 + x2) - 120*cos(x1) + 20*cos(x2) + 392*sin(x1) - 10)/(30*cos(x2) + 110) =0
eqn2 = -(539*sin(x1 + x2) + 10*cos(x2) + 120*cos(x1)*cos(x2) - 392*cos(x2)*sin(x1) - 20*cos(x2)^2 + 98*sin(x1 + x2)*cos(x2))/(30*cos(x2) + 110)=0
I have tried solving them but could`t find their solutions.

Accepted Answer

Star Strider
Star Strider on 23 May 2016
Using fsolve and converting your assignments to anonymous functions, you can get one set of solutions:
eqn1 = @(x1,x2) -(49*sin(x1 + x2) - 120*cos(x1) + 20*cos(x2) + 392*sin(x1) - 10)/(30*cos(x2) + 110);
eqn2 = @(x1,x2) -(539*sin(x1 + x2) + 10*cos(x2) + 120*cos(x1)*cos(x2) - 392*cos(x2)*sin(x1) - 20*cos(x2)^2 + 98*sin(x1 + x2)*cos(x2))/(30*cos(x2) + 110);
eqn12 = @(xv) [eqn1(xv(1),xv(2)); eqn2(xv(1),xv(2))];
x_soln = fsolve(eqn12, [1; 1])
x_soln =
274.4959e-003
-274.4959e-003
Since your functions are periodic in the variables, there are an infinity of solutions. Using an initial parameter estimate of [1000,1000], the solutions are:
x_soln =
999.3010e+000
998.7520e+000
So choose the initial estimates close to those you want.

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 23 May 2016
Edited: Azzi Abdelmalek on 23 May 2016
syms x1 x2
eqn1 = -(49*sin(x1 + x2) - 120*cos(x1) + 20*cos(x2) + 392*sin(x1) - 10)/(30*cos(x2) + 110)
eqn2 = -(539*sin(x1 + x2) + 10*cos(x2) + 120*cos(x1)*cos(x2) - 392*cos(x2)*sin(x1) - 20*cos(x2)^2 + 98*sin(x1 + x2)*cos(x2))/(30*cos(x2) + 110)
sol=solve(eqn1,eqn2)
x1=double(sol.x1)
x2=double(sol.x2)

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!