How to solve a nonlinear system of n equations

1 回表示 (過去 30 日間)
Joseph El Bacha
Joseph El Bacha 2014 年 10 月 14 日
回答済み: Alex Sha 2019 年 12 月 11 日
Hi, I solved a nonlinear system of n equations using fsolve and it succeeded. But I couldnt solve another nonlinear system using fsolve. In fact it worked but its giving me wrong answers. I sent an email to mathworks but had no reply. Can Anyone help plz ?
  2 件のコメント
Michael Haderlein
Michael Haderlein 2014 年 10 月 14 日
Knowing nothing about your system of equations, it's impossible to say anything. Please give details about the equations and show the code which resulted in wrong values. Also, write how you know the correct results.
Joseph El Bacha
Joseph El Bacha 2014 年 10 月 14 日
Thank you for answering.
Please find 2 M.files as attachments trying to resume my whole problem. I have a catalog of the right answers and Im sure my system is giving me wrong answers. The right vector for the files I uploaded is (42.00 60.00 78.00).
P.S: I can get this result if I insert it as an initial vector. But I dont want to do that.

サインインしてコメントする。

回答 (3 件)

Alan Weiss
Alan Weiss 2014 年 10 月 14 日
Your function is not smooth--it has both abs and sign calls. Therefore you cannot expect fsolve to work effectively starting from every point.
For more help, see fsolve could not solve the equation, which basically says that for this kind of problem you have to start from a wide variety of points.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  1 件のコメント
Joseph El Bacha
Joseph El Bacha 2014 年 10 月 14 日
Thank you for answering.
I already tried different initial points but it is not working unless I am 10^-5 close to the right answer.
How am I supposed to solve it through MATLAB if fsolve cannot help ?

サインインしてコメントする。


Matt J
Matt J 2014 年 10 月 14 日
編集済み: Matt J 2014 年 10 月 14 日
In view of how difficult your equations are, and because there are only 3 unknowns, I would just use exhaustive search, but in a multiresolution way. Start by sampling F(x1,x2,x3) on a coarse grid,e.g. with
[x1,x2,x3]=ndgrid(0:.1:10);
Evaluate F at all points on this grid (using vectorization, of course) and use min() to find the least norm(F) over all points. Then create a finer grid in the near neighborhood of the approximate solution and repeat...

Alex Sha
Alex Sha 2019 年 12 月 11 日
some results:
1:
x1: 1.04727193704753
x2: 2.09481403258296
x3: -3.14176920919256
2:
x1: -1.04719783053703
x2: 4.76397520013691E-7
x3: 1.04719557784678
3:
x1: -1.04722327842385
x2: -1.0469722124015
x3: 3.14151227631221

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by