Skip to content

Instantly share code, notes, and snippets.

@senhorinha
Created September 13, 2013 18:13
Show Gist options
  • Save senhorinha/6554120 to your computer and use it in GitHub Desktop.
Save senhorinha/6554120 to your computer and use it in GitHub Desktop.
Métodos Iterativos - Cálculo Numérico
% Método de Jacobi: Usa sempre os valores iniciais
m = 3;
xAntigo = [0 0 0];
erro 99;
k = 0;
while(erro > 1.e-6 && k < 100)
k++
xNovo(1) = ( 1 + xAntigo(2) + xAntigo(3)) /3;
xNovo(2) = ( 5 - xAntigo(1) - xAntigo(3)) /3;
xNovo(3) = ( 4 - 2*xAntigo(1) + 2*xAntigo(2)) /4;
%Terminar Erro
erro = abs(xNovo(1) - xAntigo(1))
xAntigo = xNovo
end
@senhorinha
Copy link
Author

  1. Jacobi : Utiliza sempre os valores inicias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment