Nonlinear system using newton

7 ビュー (過去 30 日間)
Aldo
Aldo 2016 年 11 月 10 日
編集済み: Torsten 2016 年 11 月 10 日
I am supposed to find the solution to these two functions, and according to wolfram alpha there are two intersections between these two functions.
x=[0 2]'; iter=0; dxnorm=1;
disp(' x f J dx')
while dxnorm>0.5e-9 & iter<10
f=[((x(1)-4)/5)^2 + ((x(2)-6)/7)^2-1
10*(x(1)^10-5*x(1).^2+6*x(1)-1)-x(2)
];
J=[2/5*((x(1)-4)/5) 2/7*((x(2)-6)/7)
10*(3*x(1).^2-10*x(1)+6) -1];
dx=-J\f;
disp([x f J dx]), disp(' ')
x=x+dx;
iter= iter+1;
end
x, iter
my code give these solutions though, what am I doing wrong. And how do you solve it with 6 decimals?
Best regards

採用された回答

John D'Errico
John D'Errico 2016 年 11 月 10 日
Your code gave the correct solution!
Why do you think that Newton's method will yield both solutions from one starting value? That is clearly impossible. You should know, since you apparently wrote the code. You did, right?
Optimization tools will find ONE solution at best from ONE set of starting values. Sometimes they will diverge, or fail to converge for variety of reasons.
So just pick a different point to start it from.

その他の回答 (1 件)

Torsten
Torsten 2016 年 11 月 10 日
編集済み: Torsten 2016 年 11 月 10 日
You'll get all solutions if you insert y from the second equation in the first equation and use MATLAB's "roots" command to determine the zeros of the resulting polynomial of order 6.
Best wishes
Torsten.

カテゴリ

Help Center および File ExchangeLinear Least Squares についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by