numerical anasis matlabFixed point iteration For the rest of

numerical anasis

(matlab)Fixed point iteration: For the rest of this assignment, you will be using the M-files to compute a fixed point, and you will be experimentally finding the rate of convergence of the fixed point method as well as determining the asymptotic error constant, .

(a) Let x = f(x) = x 2 + 2 2x . (b) Let x = f(x) = cos x. ((c) Let x = f(x) = (6x x ^3)/ 4 (d) Let x = f(x) = tan x xe^(x ^2 ). Use use a mfile with error tolerance 1.e-8, maximum number of iterations 25, and initial guess x0 = 100. (Note that the ini)tial guess was deliberately chosen to be large.) Give all answers accurate to as many decimal places as are shown using format long in matlab.

• The approximate root is .________

• It appears that the value of is ________, so that the method appears to be convergent.

• The experimentally determined asymptotic error constant is .__________

• This is verified by computing the value of the following derivative(s):__________ .

In the space below, show all of the derivative(s) that you compute so that I can see your work.

Solution

function y = fixedpoint(g,p0,tol,max1)

for k=1:max1

p = g(p0);

abserr = abs(p-p0);

relerr = abserr/( abs(p)+eps );

% eps is a MATLAB defined constant for machine epsilon, to avoid

% division by 0

if (abserr<tol) & (relerr<tol)

break % jump out of the loop; we’re done

end

p0 = p;

end

if (k==max1)

disp(’The algorithm did not converge’)

end

y = p;

numerical anasis (matlab)Fixed point iteration: For the rest of this assignment, you will be using the M-files to compute a fixed point, and you will be experim

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site