elimingauss - end b(j,1)=b(j,1)+coef*b(i,1) end end %...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 % PROGRAMA: ELIMINACION GAUSSIANA % Descripcion:El programa encuentra las raices de un conjunto de ecuaciones lineales de la forma % A x X = B, utilizando el metodo de eliminacion gaussiana. % curso: Calculo Numerico % programacion: Rony Yupanqui G. % fecha: Setiembre 2006 %------------VARIABLES---------% % dimension de la matriz A n=4 % declaracion de las dimensiones de las matrices a=zeros(n,n) b=zeros(n,1) x=zeros(n,1) % ingreso de los datos de las matrices A y B a = [1 -1 2 -1 b = [1 %----------ALGORITMO DEL PROGRAMA----------% disp(' PROGRAMA: ELIMINACION GAUSSIANA') % eliminacion gaussiana for i=1:(n-1), for j=(i+1):n, coef=-1*a(j,i)/a(i,i) for k=1:n, a(j,k)=a(j,k)+coef*a(i,k)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end b(j,1)=b(j,1)+coef*b(i,1) end end % sustitucion reversiva para la obtencion de las soluciones fila=n while fila>0, valor =a(fila,fila) for i=1:n, a(fila,i)=a(fila,i)/valor end b(fila,1)=b(fila,1)/valor x(fila,1)=b(fila,1) if fila<n for i=(fila+1):n, x(fila,1)=x(fila,1)-a(fila,i) end end for j=1:(fila-1), a(j,fila)=a(j,fila)*x(fila,1) end fila=fila-1 end disp('ARREGLO TRIANGULAR SUPERIOR DE LA MATRIZ A') disp(a) disp('COEFICIENTES DE LOS SEGUNDOS MIEMBROS DE LAS ECUACIONES: B') Sheet1 Page 2 disp(b) disp('SOLUCIONES X DE LAS ECUACIONES') disp(x) Sheet1 Page 3 2 1 -1 1-1 1 1 -1 3 1 -1 1] 1 1 1] Sheet1 Page 4...
View Full Document

This note was uploaded on 06/18/2008 for the course MATH Calc taught by Professor Doig during the Spring '08 term at Pontifical Catholic University of Peru.

Page1 / 4

elimingauss - end b(j,1)=b(j,1)+coef*b(i,1) end end %...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online