Question: Secant method is given by df = (f(i+1) - f(i))/(x(i+1)-x(i)); x(i+2) = x(i+1) - f(i+1)/df; A MATLAB Script (with bug), using the 'for-loop', to compute

Secant method is given by

df = (f(i+1) - f(i))/(x(i+1)-x(i)); x(i+2) = x(i+1) - f(i+1)/df; 

A MATLAB Script (with bug), using the 'for-loop', to compute the root of f(x) = x^4 - 8 is given by

 x1 = -2; f1=x1^4-16; x2 = 3; f2=x2^4-16; n=3; for i=1:n df=(f2 + x1)*(x1-f1); x3=x1 + x2/df; f3=x3*4-16; disp([i x1 x2 x3]) x1=x2; x2=x3; f1=f2; f2=f3; end 

(a) Fix the bug and write the correct code. (b) What is the value of the root closest to at 8 iteration?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!