Newton raphson tranfsorm from 1d to 2d

1 回表示 (過去 30 日間)
bbah
bbah 2019 年 12 月 1 日
編集済み: David Wilson 2019 年 12 月 2 日
i have the solution for a 1d problem. How to solve it in 2d ?
1D:
function [x] = my_NR(fun, dfun, x_0,E_tol)
q = 1;
E = inf;
x(q) = x_0;
while E > E_tol
x(q+1) = x(q) - (fun(x(q)))/(dfun(x(q)));
E = abs(x(q+1)-x(q));
q = q+1;
end
end
How to do it in 2D ?
e.g
Input : f = @(x)[0.5*cos(x(1))-0.5*sin(x(2))-x(1);0.5*sin(x(1))+0.5*cos(x(2)-x(2))];
J = @(x)[-0.5*sin(x(1))-1,-0.5*cos(x(2));0.5*cos(x(1)),-0.5*sin(x(2))-1];
x_0 =[0 0]';
E_tol = 10E-04;
Output: x = [0.0 0.0 ;0.2 0.6;0.2287 0.5423;0.2291 0.5391]
  1 件のコメント
David Wilson
David Wilson 2019 年 12 月 2 日
編集済み: David Wilson 2019 年 12 月 2 日
The Newton-Rhapson is generally specific to 1D. If you want the more general nD case, you need to use the (multivariable) Newton scheme. See e.g. http://fourier.eng.hmc.edu/e176/lectures/NM/node21.html
or of course look up Wikipedia
If you want to just solve your particular problem then try fsolve.
By the way, do you really mean (in the 2nd equation of f(x))
cos(x(2)-x(2))
And is J above the Jacobian? (It's not what I compute!)

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeNewton-Raphson Method についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by