solve the following nonlinear system using Newtons method in

solve the following nonlinear system using Newton\'s method in Matlab:

x^2=y+sin(z)

x+20=y-sin(10y)

(1-x)z=2

Hint: You need to find a suitable starting value for x,y, and z so that the method converges.

Show the matlab code you used.

Solution

%defining maximum iterations
maxiter=1000;

% convergence
epsilon=0.0000000001;

%total nonlinear equations
totalEquations=3;

% declaring equations
F1 = @(x,y,z) x^2+-y-sin(z);

F2 = @(x,y,z) x-y+sin(10y)+20;

F3 = @(x,y,z) (1-x)Z-2
F={F1,F2,F3};


loopCounter=0;
nonConverge=0;

while loopCounter<maxiter

dFidxj=zeros(totalEquations,totalEquations);

for i=1:1:totalEquations
for j=1:1:totalEquations
nls_derivada;
end
end
  
%vector values of each function

for i=1:1:totalEquations
j=F{i};
D(i,1)=j(x,y,z);
end
  
%error calculation
A=inv(dFidxj);
error=A*D;
dx=error\';
%adding error
x=x-dx;
   y=y-dy;
   z=z-dz;
  

loopCounter=loopCounter+1;
nonConverge=nonConverge+1;
% Converging.. conditoin check (error < epsilon)
  
maximumDx=max(abs(error));
  
if maximumDx<epsilon
loopCounter=maxiter;
end

  
end
x
y-dxz
nonConverge

solve the following nonlinear system using Newton\'s method in Matlab: x^2=y+sin(z) x+20=y-sin(10y) (1-x)z=2 Hint: You need to find a suitable starting value fo
solve the following nonlinear system using Newton\'s method in Matlab: x^2=y+sin(z) x+20=y-sin(10y) (1-x)z=2 Hint: You need to find a suitable starting value fo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site