Non linear system by Newton-Raphson
Hey, I m trying to solve a non-linear system by Newton-Raphson method with an iteration max of 10 and 10^(-8) max error.
It ‘s my 1st time using matrices in Matlab and i think i don t get it right because my answer shoul be somewhat around x=0,88 y=0,99
I would love to know what is going wrong in my code ( I hope my derivatives are right (they should be))
thanks !
f1=@(x,y) atan(y)-y.*x.^2;
f2=@(x,y) x.^2+y.^2-2*x;
x1 = 1;
y1 = 1;
P = [x1 ; y1];
F= @(P) [atan(y1)-y1.*x1.^2 ; x1.^2+y1.^2-2*x1];
JF = @(P) [-2.*x1.*y1 (1/(1+y1.^2))-(x1.^(-2)) ; 2.*x1-2 2.*y1];
error = 1;
k = 1;
while k<10 && error > 10^(-8)
Q = P-JF(P)F(P);
error = abs( norm(Q-P)/norm(Q+eps));
P=Q;
k=k+1;
end
PHey, I m trying to solve a non-linear system by Newton-Raphson method with an iteration max of 10 and 10^(-8) max error.
It ‘s my 1st time using matrices in Matlab and i think i don t get it right because my answer shoul be somewhat around x=0,88 y=0,99
I would love to know what is going wrong in my code ( I hope my derivatives are right (they should be))
thanks !
f1=@(x,y) atan(y)-y.*x.^2;
f2=@(x,y) x.^2+y.^2-2*x;
x1 = 1;
y1 = 1;
P = [x1 ; y1];
F= @(P) [atan(y1)-y1.*x1.^2 ; x1.^2+y1.^2-2*x1];
JF = @(P) [-2.*x1.*y1 (1/(1+y1.^2))-(x1.^(-2)) ; 2.*x1-2 2.*y1];
error = 1;
k = 1;
while k<10 && error > 10^(-8)
Q = P-JF(P)F(P);
error = abs( norm(Q-P)/norm(Q+eps));
P=Q;
k=k+1;
end
P Hey, I m trying to solve a non-linear system by Newton-Raphson method with an iteration max of 10 and 10^(-8) max error.
It ‘s my 1st time using matrices in Matlab and i think i don t get it right because my answer shoul be somewhat around x=0,88 y=0,99
I would love to know what is going wrong in my code ( I hope my derivatives are right (they should be))
thanks !
f1=@(x,y) atan(y)-y.*x.^2;
f2=@(x,y) x.^2+y.^2-2*x;
x1 = 1;
y1 = 1;
P = [x1 ; y1];
F= @(P) [atan(y1)-y1.*x1.^2 ; x1.^2+y1.^2-2*x1];
JF = @(P) [-2.*x1.*y1 (1/(1+y1.^2))-(x1.^(-2)) ; 2.*x1-2 2.*y1];
error = 1;
k = 1;
while k<10 && error > 10^(-8)
Q = P-JF(P)F(P);
error = abs( norm(Q-P)/norm(Q+eps));
P=Q;
k=k+1;
end
P newton-raphson, non linear systems MATLAB Answers — New Questions