Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please give me a code with matlab.Thank you sooo much and Iwill give you a good

ID: 3861437 • Letter: P

Question

Please give me a code with matlab.Thank you sooo much and Iwill give you a good thumb.

The lecture not is here:

Problem 4. (20%) C the example of solving a system of nonlinear equations onsider by Newton's method, as given on Pages 95-97 of the Lecture notes. Write a program to carry out this iteration, using Gauss elimination to solve the 2 by 2 linear systems that arise. Use each of the following 16 initial data sets for the Newton iteration: (0) (0) (i, j), i 0,1, 2, 3, j-0, 1,2,3 Present and discuss your numerical results in a concise manner

Explanation / Answer

x = -2; Tol = 0.0000001; count = 0; dx=1; %this is a fake value so that the while loop will execute f=-13; % because f(-2)=-13 fprintf('step x dx f(x) ') fprintf('---- ----------- --------- ---------- ') fprintf('%3i %12.8f %12.8f %12.8f ',count,x,dx,f) xVec=x;fVec=f; while (dx > Tol || abs(f)>Tol) %note that dx and f need to be defined for this statement to proceed count = count + 1; fprime = 3*x^2 + 3; xnew = x - (f/fprime); % compute the new value of x dx=abs(x-xnew); % compute how much x has changed since last step x = xnew; f = x^3 + 3*x + 1; % compute the new value of f(x) fprintf('%3i %12.8f %12.8f %12.8f ',count,x,dx,f) end