Biseccion - disp N A B M ERROR error=1 yant=feval(f,b n=1 while(error>tol ya=feval(f,a yb=feval(f,b m=(a b/2 ym=feval(f,m%tipo de error

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

View Full Document Right Arrow Icon
Sheet1 Page 1 % PROGRAMA: BISECCION % Descripcion:El programa encuentra las raices de una funcion f(x) en el intervalo [a, b] % utilizando el metodo de biseccion. % curso: Calculo Numerico % programacion: Rony Yupanqui G. % fecha: Agosto 2006 % VARIABLES % extremos del intervalo a=0 b=3.14 % ingreso de la funcion f=inline('cos(x)') % tolerancia tol=0.001 % ALGORITMO DEL PROGRAMA disp(' PROGRAMA: BISECCION')
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: disp(' N A B M ERROR') error=1 yant=feval(f,b) n=1 while (error>tol) ya=feval(f,a) yb=feval(f,b) m=(a+b)/2 ym=feval(f,m) %tipo de error error=abs(ym-yant) linea=sprintf(' %d %5.8f %5.8f %5.8f %5.8f',n,a,b,m,error) disp(linea) if (ya*ym)<0 b= m else a= m end yant=ym n=n+1 end linea=sprintf('\n RAIZ UBICADA EN (X) = %5.8f ', m) disp(linea)...
View Full Document

This note was uploaded on 06/18/2008 for the course MATH Calc taught by Professor Doig during the Spring '08 term at Pontifical Catholic University of Peru.

Ask a homework question - tutors are online