フィルターのクリア

fsolve result is not desirable even giving a close starting point

2 ビュー (過去 30 日間)
Qingbin
Qingbin 2014 年 1 月 31 日
回答済み: Alex Sha 2023 年 9 月 3 日
I have three nonlinear equations with three unknowns and I used fsolve function.
I know that x=[0.3173;0.3173;3.6590] is a good enough solution for the three equations. However, using fsolve, I could not get to this solution even for a very close starting point as shown below. Instead the result is (upon plugging these results into the 3 equations, the values are not close to 0):
x =
0.999999999999936
1.000000000000067
1.000000000000036
How can this be solved? Thanks!
CODE:
x0=[0.31; 0.31; 3.5];
options=optimset('Display','iter');
[x,fval]=fsolve(@myfun1,x0,options)
function F=myfun(x)
F=[13*cos(x(3)) - 5*x(1)*x(3)^2 - 5*x(2)*x(3)^2 + 13*x(1)*x(3)*sin(x(3)) + 13*x(2)*x(3)*sin(x(3)) + 10*x(1)*x(2)*x(3)^2 - 13*x(1)*x(2)*x(3)^2*cos(x(3)) + 40;
5*x(3) - 13*sin(x(3)) + 30*x(1)*x(3) + 13*x(1)*x(3)*cos(x(3)) + 13*x(2)*x(3)*cos(x(3)) - 5*x(1)*x(2)*x(3)^3 + 13*x(1)*x(2)*x(3)^2*sin(x(3));
390*x(3)^2*sin(x(3)) + 300*x(1)*x(3)^3 - 25*x(1)*x(3)^5 + 25*x(2)*x(3)^5 - 150*x(3)^3 - 260*x(1)*x(3)^3*cos(x(3)) - 130*x(2)*x(3)^3*cos(x(3)) + 130*x(1)*x(3)^4*sin(x(3)) - 130*x(2)*x(3)^4*sin(x(3)) - 169*x(1)*x(3)^3*cos(x(3))^2 + 169*x(2)*x(3)^3*cos(x(3))^2 - 169*x(1)*x(3)^3*sin(x(3))^2 + 169*x(2)*x(3)^3*sin(x(3))^2
];
  2 件のコメント
Matt J
Matt J 2014 年 1 月 31 日
編集済み: Matt J 2014 年 1 月 31 日
In future, please highlight your code and apply the
formatting button, as I have just done for you now.
Qingbin
Qingbin 2014 年 1 月 31 日
Thanks, I will do this later.

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

採用された回答

Matt J
Matt J 2014 年 1 月 31 日
編集済み: Matt J 2014 年 1 月 31 日
Possibly because you're passing @myfun1 to fsolve instead of @myfun? When I make this change and run your code, I get the solution you expect.
  2 件のコメント
Qingbin
Qingbin 2014 年 1 月 31 日
編集済み: Qingbin 2014 年 1 月 31 日
Thanks! Sorry for the mistake. One question to follow up is that how can I give a good estimate of the starting point. In the above problem, I want to solve for the max{x(3)} and min{x(3)}.
Matt J
Matt J 2014 年 1 月 31 日
There is no science to the initial guess. If you want solutions with the max/min possible x(3) value, try an initial guess with parameters well above/below what x(3) would naturally be.

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

その他の回答 (1 件)

Alex Sha
Alex Sha 2023 年 9 月 3 日
For Qingbin's equations, although it is a problem that has passed a long time, it is worth and interesting to have a try, there are multi-solutions:
The first one:
x1: -12.7613758329431
x2: -12.7613758329431
x3: -0.755039591199301
The second one:
x1: 0.101047394240414
x2: -3.71598808815167
x3: -1.63192533266968
The third one:
x1: -0.282297628581163
x2: 0.369875309676247
x3: 3.09470113469319
The fourth one:
x1: 0.317262018077202
x2: 0.317262018077202
x3: 3.65895757009226

カテゴリ

Help Center および File ExchangeSystems of Nonlinear Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by