Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Curso:
METODOS NUMERICOS
Docente:
AYALA MINA JORGE GERARDO
Integrantes:
GUEVARA CALLE, BRAYSSON
JOHNNY
2018
Metodo de la secante
%Método de la secante.
cf = input('Ingrese la función: ');
f = inline(cf);
x0 = input('Ingrese el primer valor: ');
x1 = input('Ingrese el segundo valor: ');
tol = input('Ingrese tolerancia: ');
error = 100;
n=0;
fprintf(' n x0 x1 x2 error\n');
fprintf(' %i %4.4f %4.4f --- ---\n',n,x0,x1);
while( error > tol )
n = n+1;
x2 = x1 - (x1-x0)*f(x1)/(f(x1)-f(x0));
error = abs(f(x2));
fprintf(' %i %4.4f %4.4f %4.4f %4.4f\n',n,x0,x1,x2,error);
x0 = x1;
x1 = x2;
end
FUNCION METODO DE LA FALSA SUPOSICION
c = 0; n = 0; error = 100;
fprintf('\t n \t\ta \t\t c \t\t b \t\terror\n')
%Método de la bisección.
%Método de la bisección.
clear, clc
h = input('Ingrese la función a analizar: ');
f = inline(h);
a = input('Ingrese el limite inferior del intervalo: ');
b = input('Ingrese el limite superior del intervalo: ');
tol = input('Indique la tolerancia deseada: ');
c = 0;
n = 0;
MEP = (b-a)/2;
fprintf(' \t n \t\ta \t\t c \t\t b \t\t MEP\n');