Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone explain this matlab code for Newton's method? specificaly the lines that i marked with %%%% Then, use your function to estimate 7 by

can someone explain this matlab code for Newton's method? specificaly the lines that i marked with %%%%

Then, use your function to estimate 7 by finding the positive root of f(x) = x2 7. Try two different initial guesses: (i) x0 = 2 and (ii) x0 = 500 and consider |xk+1 xk| < 10^10 as a convergence criterion.

>> clear all close all clc f=@(x) x^2-7; df=@(x) 2*x; n=10;%%%%% x=zeros(1,n);%%%%% x(1)=2; for i=1:n fun=f(x(i)); derfun=df(x(i)); frac=f(x(i))/df(x(i)); x(i+1)=x(i)-(f(x(i))/df(x(i))); error=abs(x(i+1)-x(i)) end x'

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions