Could not solve 2 equations using the MATLAB.

1 vue (au cours des 30 derniers jours)
kalpana
kalpana le 9 Août 2013
I have to solve two equations using MATLAB. For this, i have taken the equations as the following :
syms x y eq1 eq2;
eq1 = x^7 + 42.215449*x^6*y + 287.89234 *x^6 + 596.846934 * x^5*y^2 + 8742*x^5*y + 28324*x^5 + 2043*x^4*y^3 + 43094*x^4*y^2 + 266735*x^4*y + 498519*x^4 + 288.63823*x^3*y^4 + 33339*x^3*y^3 + 520794*x^3*y^2 + 2476074*x^3*y + 3223591*x^3 - 208.79156*x^2*y^5 + 6073*x^2*y^4 + 234014*x^2*y^3 + 2220025*x^2*y^2 + 7793982*x^2*y + 8129372*x^2 - 52.07952*x*y^6 + 104.05264*x*y^5 + 35721*x*y^4 + 555238*x*y^3 + 3446089*x*y^2 + 9208694*x*y + 8083970*x - 3.07772*y^7 - 21.7637*y^6 + 1870*y^5 + 42024*y^4 + 374588*y^3 + 1636383*y^2 + 3381409*y + 2510676 ;
eq2 = x^7 + 42.35951*x^6*y + 249.65506*x^6 + 384.45864*x^5*y^2 + 3593*x^5*y + 6262*x^5 + 820.0502*x^4*y^3 + 11020*x^4*y^2 + 42458*x^4*y + 42460*x^4 - 190.762*x^3*y^4 + 323.880*x^3*y^3 + 12187*x^3*y^2 - 14416*x^3*y - 53002*x^3 - 273.565*x^2*y^5 - 10984*x^2*y^4 - 144716*x^2*y^3 - 769764*x^2*y^2 - 1669218*x^2*y - 1214524*x^2 - 61.9525*x*y^6 - 3876*x*y^5 - 75440*x*y^4 - 643676*x*y^3 - 2570248*x*y^2 - 4473769*x*y - 2750044*x - 4.1241*y^7 - 333.6706*y^6 - 8419*y^5 - 99085*y^4 - 607023*y^3 - 1930062*y^2 - 2885924*y - 1593986;
I tried to solve for the x & y values using the command : SS = solve(eq1, eq2) But, even after waiting for 6 hours also, it did not give any out put.
I tried to use even fsolve also for solving the eq1 & eq2 equations. But, because of not giving the initial guess properly, Matlab is not giving the correct outputs.
Can anyone please help me in trying to solve these equations? I am desperate for the answer.

Réponse acceptée

David Sanchez
David Sanchez le 9 Août 2013
No need of symbolic calculus. Apdapt the example to your equations:
This example solves the system of two equations and two unknowns:
Rewrite the equations in the form F(x) = 0:
Start your search for a solution at x0 = [-5 -5].
First, write a file that computes F, the values of the equations at x ( in your case x = x(1) and y = x(2) ) .
function F = myfun(x)
F = [2*x(1) - x(2) - exp(-x(1));
-x(1) + 2*x(2) - exp(-x(2))];
Save this function file as myfun.m somewhere on your MATLAB path.
Next, set up the initial point and options and call fsolve:
x0 = [-5; -5]; % Make a starting guess at the solution
options=optimset('Display','iter'); % Option to display output
[x,fval] = fsolve(@myfun,x0,options) % Call solver
  1 commentaire
kalpana
kalpana le 9 Août 2013
Thank you for your answer. But, i made some initial guesses and used fsolve function to get the solution for the equations. But, i did not get the correct answer because of wrong initial guesses.
Can you please tell me how to get the initial guess for the fsolve function ?
Thank you once again for your answer.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by