0% found this document useful (0 votes)
16 views9 pages

Practica Laboratorio (Matlab)

The document describes the steps to perform Gaussian elimination on a matrix A to solve a system of linear equations. It shows: 1) Defining the initial matrix A and vector b; 2) Performing row operations on A by subtracting combinations of rows from other rows to reduce A to row echelon form; 3) Dividing rows by their leading term to obtain an upper triangular matrix.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views9 pages

Practica Laboratorio (Matlab)

The document describes the steps to perform Gaussian elimination on a matrix A to solve a system of linear equations. It shows: 1) Defining the initial matrix A and vector b; 2) Performing row operations on A by subtracting combinations of rows from other rows to reduce A to row echelon form; 3) Dividing rows by their leading term to obtain an upper triangular matrix.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

PRACTICA LABORATORIO (MATLAB)

JHORLIN ALVEAR ROA (251910027)


ING MECATRONICA

ALEXANDER GUTIERREZ

ALGEBRA LINEAL (CB0006)


04/2019
TALLER FORMACION DEL METODO GAUSS JORDAN Y ALGORITMO

octave:20> A=[2,4,6,10,8;4,6,1,10,2;3,0,8,5,1;2,4,1,5,2;0,0,2,4,6]
A=

2 4 6 10 8
4 6 1 10 2
3 0 8 5 1
2 4 1 5 2
0 0 2 4 6

octave:21> b=[8;10;2;2;4]
b=

8
10
2
2
4

octave:22> A=[A,b]
A=

2 4 6 10 8 8
4 6 1 10 2 10
3 0 8 5 1 2
2 4 1 5 2 2
0 0 2 4 6 4

octave:23> A(1,1:6)=A(1,1:6)/A(1,1)
A=

1 2 3 5 4 4
4 6 1 10 2 10
3 0 8 5 1 2
2 4 1 5 2 2
0 0 2 4 6 4
>>> A(2,1:6)=A(2,1:6)-A(5,3)*(4,1:6)
^

octave:24> A(2,1:6)=A(2,1:6)-A(5,3)*A(4,1:6)
A=

1 2 3 5 4 4
0 -2 -1 0 -2 6
3 0 8 5 1 2
2 4 1 5 2 2
0 0 2 4 6 4

octave:25> A(3,1:6)=A(3,1:6)-A(3,1)*A(1,1:6)
A=

1 2 3 5 4 4
0 -2 -1 0 -2 6
0 -6 -1 -10 -11 -10
2 4 1 5 2 2
0 0 2 4 6 4

octave:26> A(4,1:6)=A(4,1:6)-A(4,1)*A(1,1:6)
A=

1 2 3 5 4 4
0 -2 -1 0 -2 6
0 -6 -1 -10 -11 -10
0 0 -5 -5 -6 -6
0 0 2 4 6 4
octave:27> A(2,2:6)=A(2,2:6)/A(2,2)
A=

1.00000 2.00000 3.00000 5.00000 4.00000 4.00000


0.00000 1.00000 0.50000 -0.00000 1.00000 -3.00000
0.00000 -6.00000 -1.00000 -10.00000 -11.00000 -10.00000
0.00000 0.00000 -5.00000 -5.00000 -6.00000 -6.00000
0.00000 0.00000 2.00000 4.00000 6.00000 4.00000

octave:28> A(1,2:6)=A(1,2:6)-A(1,2)*A(2,2:6)
A=

1.00000 0.00000 2.00000 5.00000 2.00000 10.00000


0.00000 1.00000 0.50000 -0.00000 1.00000 -3.00000
0.00000 -6.00000 -1.00000 -10.00000 -11.00000 -10.00000
0.00000 0.00000 -5.00000 -5.00000 -6.00000 -6.00000
0.00000 0.00000 2.00000 4.00000 6.00000 4.00000

octave:29> A(3,2:6)=A(3,2:6)-A(3,2)*A(2,2:6)
A=

1.00000 0.00000 2.00000 5.00000 2.00000 10.00000


0.00000 1.00000 0.50000 -0.00000 1.00000 -3.00000
0.00000 0.00000 2.00000 -10.00000 -5.00000 -28.00000
0.00000 0.00000 -5.00000 -5.00000 -6.00000 -6.00000
0.00000 0.00000 2.00000 4.00000 6.00000 4.00000

octave:30> A(3,3:6)=A(3,3:6)/A(3,3)
A=

1.00000 0.00000 2.00000 5.00000 2.00000 10.00000


0.00000 1.00000 0.50000 -0.00000 1.00000 -3.00000
0.00000 0.00000 1.00000 -5.00000 -2.50000 -14.00000
0.00000 0.00000 -5.00000 -5.00000 -6.00000 -6.00000
0.00000 0.00000 2.00000 4.00000 6.00000 4.00000
octave:31> A(1,3:6)=A(1,3:6)-A(1,3)*A(3,3:6)
A=

1.00000 0.00000 0.00000 15.00000 7.00000 38.00000


0.00000 1.00000 0.50000 -0.00000 1.00000 -3.00000
0.00000 0.00000 1.00000 -5.00000 -2.50000 -14.00000
0.00000 0.00000 -5.00000 -5.00000 -6.00000 -6.00000
0.00000 0.00000 2.00000 4.00000 6.00000 4.00000

octave:32> A(2,3:6)=A(2,3:6)-A(2,3)*A(3,3:6)
A=

1.00000 0.00000 0.00000 15.00000 7.00000 38.00000


0.00000 1.00000 0.00000 2.50000 2.25000 4.00000
0.00000 0.00000 1.00000 -5.00000 -2.50000 -14.00000
0.00000 0.00000 -5.00000 -5.00000 -6.00000 -6.00000
0.00000 0.00000 2.00000 4.00000 6.00000 4.00000

octave:33> A(4,3:6)=A(4,3:6)-A(4,3)*A(3,3:6)
A=

1.00000 0.00000 0.00000 15.00000 7.00000 38.00000


0.00000 1.00000 0.00000 2.50000 2.25000 4.00000
0.00000 0.00000 1.00000 -5.00000 -2.50000 -14.00000
0.00000 0.00000 0.00000 -30.00000 -18.50000 -76.00000
0.00000 0.00000 2.00000 4.00000 6.00000 4.00000

octave:34> A(5,3:6)=A(5,3:6)-A(5,3)*A(3,3:6)
A=

1.00000 0.00000 0.00000 15.00000 7.00000 38.00000


0.00000 1.00000 0.00000 2.50000 2.25000 4.00000
0.00000 0.00000 1.00000 -5.00000 -2.50000 -14.00000
0.00000 0.00000 0.00000 -30.00000 -18.50000 -76.00000
0.00000 0.00000 0.00000 14.00000 11.00000 32.00000
octave:35> A(4,4:6)=A(4,4:6)/A(4,4)
A=

1.00000 0.00000 0.00000 15.00000 7.00000 38.00000


0.00000 1.00000 0.00000 2.50000 2.25000 4.00000
0.00000 0.00000 1.00000 -5.00000 -2.50000 -14.00000
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 14.00000 11.00000 32.00000

octave:36> A(1,4:6)=A(1,4:6)-A(1,4)*A(4,4:6)
A=

1.00000 0.00000 0.00000 0.00000 -2.25000 0.00000


0.00000 1.00000 0.00000 2.50000 2.25000 4.00000
0.00000 0.00000 1.00000 -5.00000 -2.50000 -14.00000
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 14.00000 11.00000 32.00000

octave:37> A(2,4:6)=A(2,4:6)-A(2,4)*A(4,4:6)
A=

1.00000 0.00000 0.00000 0.00000 -2.25000 0.00000


0.00000 1.00000 0.00000 0.00000 0.70833 -2.33333
0.00000 0.00000 1.00000 -5.00000 -2.50000 -14.00000
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 14.00000 11.00000 32.00000

octave:38> A(3,4:6)=A(3,4:6)-A(3,4)*A(4,4:6)
A=

1.00000 0.00000 0.00000 0.00000 -2.25000 0.00000


0.00000 1.00000 0.00000 0.00000 0.70833 -2.33333
0.00000 0.00000 1.00000 0.00000 0.58333 -1.33333
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 14.00000 11.00000 32.00000
octave:39> A(5,4:6)=A(5,4:6)-A(5,4)*A(4,4:6)
A=

1.00000 0.00000 0.00000 0.00000 -2.25000 0.00000


0.00000 1.00000 0.00000 0.00000 0.70833 -2.33333
0.00000 0.00000 1.00000 0.00000 0.58333 -1.33333
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 0.00000 2.36667 -3.46667

octave:40> A(5,5:6)=A(5,5:6)/A(5,5)
A=

1.00000 0.00000 0.00000 0.00000 -2.25000 0.00000


0.00000 1.00000 0.00000 0.00000 0.70833 -2.33333
0.00000 0.00000 1.00000 0.00000 0.58333 -1.33333
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 0.00000 1.00000 -1.46479

octave:41> A(1,5:6)=A(1,5:6)-A(1,5)*A(5,5:6)
A=

1.00000 0.00000 0.00000 0.00000 0.00000 -3.29577


0.00000 1.00000 0.00000 0.00000 0.70833 -2.33333
0.00000 0.00000 1.00000 0.00000 0.58333 -1.33333
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 0.00000 1.00000 -1.46479

>>> A=(2,5:6)=A(2,5:6)-A(2.5)*A(5,5:6)

A=

1.00000 0.00000 0.00000 0.00000 0.00000 -3.29577


0.00000 1.00000 0.00000 0.00000 0.00000 -1.29577
0.00000 0.00000 1.00000 0.00000 0.58333 -1.33333
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 0.00000 1.00000 -1.46479
A=

1.00000 0.00000 0.00000 0.00000 0.00000 -3.29577


0.00000 1.00000 0.00000 0.00000 0.00000 -1.29577
0.00000 0.00000 1.00000 0.00000 0.00000 -0.47887
0.00000 0.00000 0.00000 1.00000 0.61667 2.53333
0.00000 0.00000 0.00000 0.00000 1.00000 -1.46479

octave:44> A(4,5:6)=A(4,5:6)-A(4,5)*A(5,5:6)
A=

1.00000 0.00000 0.00000 0.00000 0.00000 -3.29577


0.00000 1.00000 0.00000 0.00000 0.00000 -1.29577
0.00000 0.00000 1.00000 0.00000 0.00000 -0.47887
0.00000 0.00000 0.00000 1.00000 0.00000 3.43662
0.00000 0.00000 0.00000 0.00000 1.00000 -1.46479

octave:45> X=A(1:5,6)
X=

-3.29577
-1.29577
-0.47887
3.43662
-1.46479

octave:46> A=[2,4,6,10,8;4,6,1,10,2;3,0,8,5,1;2,4,1,5,2;0,0,2,4,6]
A=

2 4 6 10 8
4 6 1 10 2
3 0 8 5 1
2 4 1 5 2
0 0 2 4 6
octave:47> A*X
ans =

8.0000
10.0000
2.0000
2.0000
4.0000

You might also like