Documentos de Académico
Documentos de Profesional
Documentos de Cultura
METODOS NUMERICOS
NOMBRE: BRAYAN CARDENAS
NIVEL: CUARTO G1
METODOS NUMERICOS EN MATLAB
MENU DE OPCIONES
VISUALIZACION
METODO DE LA BISECCION
clc
clear all
VISUALIZACION
clc
clear all
disp('Ingrese la funcion de iteracion g(x) para encontrar la raiz de
otra funcion')
g=input('Puede ser otro literal. f(x)=','s');
r=input('Ingrese el punto inicial: ');
alto=0;
while alto==0
disp('Seleccione 1 para el criterio de error relativo o 2 para
seleccionar por numero de iteraciones')
s=input('escoja la opcion: ');
switch s
case 1
epsilon=input('Ingrese maximo error relativo: ');
alto=1;
case 2
maxit=input('Ingrese maximo numero de iteraciones');
alto=1;
otherwise
disp('Ocion no valida, Seleccione 1 o 2: ')
end
end
it=1;
alto=0;
while alto==0
gr=subs(g,r);
err=abs((gr-r)/(gr));
if s==1
if epsilon >= err
alto=1;
end
end
if s==2
if maxit<=it
alto=1;
end
end
disp(['--------Iteracion numero ' num2str(it) '------'])
disp(['La aproximacion es: ' num2str(gr)])
disp(['El error relativo es: ' num2str(err)])
r=gr;
it=it+1;
end
clc
clear all
disp('Ingrese una funcion derivable dependiente de x')
f=input('Ingrese la funcion para analizar. f(x)=','s');
r=input('Ingrese el punto inicial: ');
df=diff(f,sym('x'));
alto=0;
while alto ==0
disp('Seleccione 1 para seleccionar el criterio relativo o 2 para
seleccionar el numero de iteraciones')
s=input('Escoja la opcion deseada: ');
switch s
case 1
epsilon=input('Ingrese maximo error relativo: ');
alto=1;
case 2
maxit=input('Ingrese maximo numero de iteraciones: ');
alto=1;
otherwise
disp('Opcion no valida, Ingrese 1 o 2: ')
end
end
it=1;
alto=0;
while alto==0
evf=subs(f,r);
evdf=subs(df,r);
if evdf==0
disp('Derivada evualada igual a cero en alguna iteracion')
return
end
r1=r-(evf/evdf);
err=abs((r1-r)/(r1));
if s==1
if epsilon >=err
alto=1;
end
end
if s==2
if maxit <= it
alto=1;
end
end
raiz = num2str(r1);
error = num2str(err);
disp(['-------Iteracion numero' num2str(it) '--------'])
disp('La aproximacion es',raiz)
disp('El error relativo es',error)
r=r1;
it=it+1;
end
EJECUCION DEL PROGRAMA
METODO DE LA SECANTE
clear all
clc
disp('Ingrese una funcion derivable dependiente de x')
f=input('Ingrese la funcion para analizar. f(x)=','s');
r=input('Ingrese el punto inicial: ');
df=diff(f,sym('x'));
alto=0;
while alto ==0
disp('Seleccione 1 para seleccionar el criterio relativo o 2 para
seleccionar el numero de iteraciones')
s=input('Escoja la opcion deseada: ');
switch s
case 1
epsilon=input('Ingrese maximo error relativo: ');
alto=1;
case 2
maxit=input('Ingrese maximo numero de iteraciones: ');
alto=1;
otherwise
disp('Opcion no valida, Ingrese 1 o 2: ')
end
end
it=1;
alto=0;
while alto==0
evf=subs(f,r);
evfc=subs(f,r+0.001);
r1=r-((0.001*evfc)/(evfc-evf));
err=abs((r1-r)/(r1));
if s==1
if epsilon >= err
alto =1;
end
end
if s==2
if maxit <= it
alto = 1;
end
end
disp(['-------Iteracion numero' num2str(it) '--------'])
disp(['La aproximacion es: ' num2str(r1)])
disp(['El error relativo es: ' num2str(err)])
r=r1;
it=it+1;
end
CONCLUCIONES
5. El método de punto fijo busca hallar las raíces en funciones de la forma, a través de
aproximaciones sucesivas que convergen a la solución de la ecuación.
BIBLIOGRAFIA