Using Newton Raphson Approach Nonlinear Systems Write Matlab Script Shows Results Two Diff Q37056301

Using a Newton Raphson approach to nonlinear systems to write aMatlab script and shows the results for two different functions


Solution


`Hey,

Note: Brother in case of any queries, just comment inbox I would be very happy to assist all your queries

clc
clear all
close all

f = @(x) log(x+4)-2;

g=@(x) 1/(x+4);
x0=1;
e=0.01e-4;
maxit=100;
x1=x0;
x0=0;
N=0;
err=[];
while 1

if abs(f(x1))>e
x0=x1;
x1=x0-(f(x0)/g(x0));
N=N+1;

else

break;

end
if(N==maxit)
break;
end

end
root=x1;
iter=N;
disp(‘So, final approximation is’)
(root)
fprintf(‘Number of iteration is %dn’,N);
fprintf(‘Approximate absolute relative error is%fn’,abs(x1-x0)/abs(x1));

MATLAB R2018a ② ▼| rch Documentation Log In EDITOR Find Files Compare Print Run Section New Open Save Advance Run and Find Ti

Kindly revert for any queries

Thanks.

MATLAB R2018a ② ▼| rch Documentation Log In EDITOR Find Files Compare

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.