Sei sulla pagina 1di 1

29/09/16 10:26 AM

C:\Users\Gerardo2\Docume...\MiPuntoFijo.m

function resultado = MiPuntoFijo(FX, GX, X0, EPS, EPS1, MAXIT)


%Abre un archivo .txt
archivo= fopen('texto.txt', 'w');
for i = 1:MAXIT
X = feval(GX, X0);
ef = feval(FX, X);
convergencia = abs(X-X0);
exactitud = abs(ef);
fprintf(archivo, '%d %f %f %f\n', i, X, convergencia, exactitud);
%Criterio de Convergencia
if (convergencia <= EPS)
resultado = strcat(num2str(X));
return
end
%Criterio de exactitud
if (exactitud <= EPS1)
resultado = strcat(num2str(X));
return
end
X0 = X;
end
%
resultado = 'No Converge';
end

1 of 1

Potrebbero piacerti anche