Está en la página 1de 1

[UNIVERSIDAD TECNOLGICA DE LOS ANTES]

CARRERA PROFESIONALDE INGENIERA CIVIL

UTEA 2010-II

PROGRAMA EN MATLAB
MTODO DE ITERACIONES SUCESIVAS
clc;
clear all;
format compact;
format long;
disp('=============================================================================');
disp(' ==========
CURSO : METODOS NUMERICOS Y PROGRAMCION
===========');
disp(' ==========
METODO: ITERACIONES SUCESIVAS "PUNTO FIJO"
===========')
disp('=============================================================================')

x=[-1:0.01:1];
y=input('ingrese un funcion y =','s');
%y=1000*x.^5-3*x-9.04
plot(x,eval(y));
title('::::... GRAFICA DE LA FUNCION ....::::','fontsize',14);
xlabel('Eje de las Abscisas','fontsize',13);
ylabel('Eje de las Ordenadas','fontsize',13);
legend(['f(x) = ',y])
grid on;
axis auto;
a=input('ingrese un punto a :');
b=input('ingrese un punto b :');
xo=input('ingrese un punto xo cualquiera del intervalo :');
gx=input('ingrese un funcion g(x) :','s');
dgx=input('ingrese un funcion g(x) :','s');
disp('====>');
disp('EALUANDO LA CONDICION DE CONVERGENCIA :');
x=xo;
cal=abs(eval(dgx));
if (cal<1)
fprintf('El valor calculado es : %f por tanto... \n',cal);
disp('==========================================================')
disp('== El intervalo especificado es correcto...!!
==')
disp('== por tanto cumple la CONDICION DE CONVERGENCIA ...!!
==')
disp('==========================================================')
disp('====>');
n=input('Ingrese el numero de iteraciones :');
fprintf('i \t\t Respuesta \n');
disp('-----------------------------------------------------------')
for (i=1:n)
x=xo;
resp(i)=eval(gx);
xo=resp(i);
fprintf('%d \t\t %f \n',i,resp(i))
end
disp('-----------------------------------------------------------')
ea=abs(resp(i)-resp(i-1));
if(ea==0)
fprintf('\n La raiz encontrada es: %.16f ',resp(i));
end
else
disp('EL INTERVALO CONSIDERADO NO ES CORRECTO...no es convergente..!!')
end

También podría gustarte