modsecant - f_prime=(f2-f)/x; ea=abs((xi-xold)/xi);...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function modsecant(xi,spf,iter) %problem 6.4, using modified secant method iter=iter+1; count=0; xold=0; disp(' i x x+dx f(x) f(x+dx) f_(x) ea'); while(1) f=8*sin(xi)*exp(-xi)-1; x=xi*spf x_dx=x+xi; f2=8*sin(x_dx)*exp(-x_dx)-1;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f_prime=(f2-f)/x; ea=abs((xi-xold)/xi); fprintf(' %1d %7.6f %6.5f %6.5f %6.5f\n',count, xi,f,f_prime,ea) xold=xi; xi=xi-(x*f)/(f2-f); count=count+1; if count==iter; break; end end...
View Full Document

This note was uploaded on 09/27/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

Ask a homework question - tutors are online