Newton - Raphson Method with multivariable
Show older comments
First of all , i do not know anything about matlab and my school gave me a matlab homework enethough we do not have matlab lessons .I am trying to make a code for nr method with multivariable but i could not do it. That code could be totally wrong but that is the best i can do. It gave eror
''
Index exceeds array bounds.
Error in sym/subsref (line 859)
R_tilde = builtin('subsref',L_tilde,Idx);
Error in aero (line 19)
C(1,1)=x(i+2);
''
function numerichw1(x0,y0,TC)
syms x y
f1= @(x,y) 1/5*(exp(-24*x)-4*sin(x*y))-0.4325;
f2= @(x,y) 1/5*(x*x*y+4*cos(x))-0.0643;
J = [ diff(f1,x) , diff(f1,y) ; diff(f2,x) , diff(f2,y) ];
T = inv(J);
i=0 ;
error =100;
x(1)=x0;
y(1)=y0;
A =[x(i+1);y(i+1)];
B =[f1(x(i+1),y0);f2(x(i+1),y(i+1))];
while (error>TC)
C = A-(T*B);
C(1,1)=x(i+2);
C(2,1)=y(i+2);
E(1,1)=abs(((C(1,1)-A(1,1))/C(1,1))*100);
E(1,2)=abs(((C(2,1)-A(2,1))/C(2,1))*100);
error=max(E);
A = C ;
i=i+1;
if (i>1000)
break;
end
end
Answers (0)
Categories
Find more on Newton-Raphson Method in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!