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 CenterFile Exchange에서 Newton-Raphson Method에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by