Академический Документы
Профессиональный Документы
Культура Документы
: Guillermo Paucar C.
Alumno
Codigo
: 030799-I
CUSCO - PERU
Joel Efran Trraga Rodrguez - 030799
Algebra Lineal
b)
B=[1 2 3;4
B=
1
2
4
5
7
8
5 6;7 8 9]
3
6
9
c)
C=[1 2 3
456
7 8 9]
C=
1
2
4
5
7
8
3
6
9
d)
D=C'
D=
1
4
2
5
3
6
7
8
9
Algebra Lineal
e)
E=[3 0 5 6]'
E=
3
0
5
6
f)
F=[1:9]
F=
1
2
10
g)
G=[1:9]'
G=
1
2
3
4
5
6
7
8
9
h)
H=[0:2:12]
H=
0
2
4
6
i)
I=[-1,3 sqrt(3) 6,4]
I=
-1.0000 3.0000
1.7321
12
6.0000
4.0000
Para qu se utiliza ,?
Se utiliza para separar las componentes de un vector.
Para qu se utiliza ;?
Sirve para separar las filas de una matriz unas de otras.
Para qu se utiliza :?
Indicara que se haga una fila desde el primer valor antes de (:) hasta el valor
despus de (:)
Algebra Lineal
2.- Existen funciones en el MATLAB como: rand, magic, eye, etc. Que proporcionan
uan ofrma sencilla de crear matrices con las que se puede experimentar. Introduzca
las siguientes matrices y extraiga conclusiones
a) rand(5)
ans =
0.9501
0.2311
0.6068
0.4860
0.8913
0.7621
0.4565
0.0185
0.8214
0.4447
0.6154
0.7919
0.9218
0.7382
0.1763
0.4057
0.9355
0.9169
0.4103
0.8936
0.0579
0.3529
0.8132
0.0099
0.1389
0.2722
0.1988
0.0153
0.7468
0.4451
0.9318
0.4660
0.4186
0.8462
0.5252
0.2026
0.6721
b) rand(3,5)
ans =
0.2028
0.1987
0.6038
c) magic(4)
ans =
16
2
5 11
9
7
4 14
3 13
10
8
6 12
15
1
d) eye(8)
ans =
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
e) ones(4)
ans =
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
Algebra Lineal
g) zeros(5,6)
ans =
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
h) triu(C)
ans =
1
0
0
2
5
0
3
6
9
i) tril(A)
ans =
1
4
7
0
5
8
0
0
9
j) A(:)
ans =
1
4
7
2
5
8
3
6
9
0
0
0
0
0
Algebra Lineal
k) Si x es un vector diag(x) es una amtriz diagonal con los elementos de x en su
diagonal, si A es una matriz cuadrada diag(A) es un vector formado por los
elementos de la diagonal de A. Que ser entonces diag(diag(a))?
X=[7 8 9]
X=
7
8
diag(X)
ans =
7
0
0
8
0
0
0
0
9
diag(A)
ans =
1
5
9
-4;4 2;6 8]
-4
2
8
N=
-6
2
14
a) -M
ans =
-2
-4
-6
4
-2
-8
b) M+N
ans =
-4
0
6 12
20 20
c) M-N
ans =
8 -8
2 -8
-8 -4
d) O+M
??? Error using ==> +
Matrix dimensions must agree.
4
10
12
O=[6 -6;2 8]
O=
6 -6
2
8
Algebra Lineal
e) M*O
ans =
4 -44
28 -8
52 28
f) M*N
??? Error using ==> +
Matrix dimensions must agree.
g) 3*O
ans =
18 -18
6 24
h) O^3
ans =
-24 -816
272 248
i) O.^3
ans =
216 -216
8 512
A=[7 5 3 1;2 6 9
4;7 3 4 8;1 6 4 7]
B=[3 2 6 4;7 6 1
3;9 7 8 2;3 4 2 9]
A=
7
2
7
1
5
6
3
6
3
9
4
4
1
4
8
7
B=
3
7
9
3
2
6
7
4
6
1
8
2
4
3
2
9
Algebra Lineal
O=zeros(4)
O=
0
0
0
0
0
0
0
0
0
0
0
0
I=eye(4)
I=
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
a)
(A+B)+C
ans =
25 13
12 19
20 13
13 17
11
14
15
14
A+(B+C)
ans =
25 13
12 19
20 13
13 17
9
16
11
24
11
14
15
14
9
16
11
24
b)
A+O
O+A
ans =
ans =
7
2
7
1
5
6
3
6
3
9
4
4
1
4
8
7
7
2
7
1
5
6
3
6
3
9
4
4
1
4
8
7
7
2
7
1
5
6
3
6
c)
A+B
ans =
10
7
9 12
16 10
4 10
9
5
10
7
12 10
6 16
B+A
ans =
10
7
9 12
16 10
4 10
d) A*B=B*A NO SE CUMPLE
A*B
B*A
ans =
ans =
86
141
102
102
69 73 58
119 98 80
92 93 117
94 58 93
71
71
135
52
9
5
10
7
12 10
6 16
69 67 87
92 91 60
123 130 115
99 89 98
3
9
4
4
1
4
8
7
Algebra Lineal
e)
A*I
I*A
ans =
ans =
7
2
7
1
5
6
3
6
3
9
4
4
1
4
8
7
7
2
7
1
5
6
3
6
3
9
4
4
9
12
10
7
16
10
12
10
1
4
8
7
f)
(A+B)'
A'+B'
ans =
ans =
10
7
9
5
9
12
10
7
16
10
12
10
4
10
6
16
10
7
9
5
4
10
6
16
g) k=5
(k*A)'
k*A'
ans =
ans =
35
25
15
5
10
30
45
20
35
15
20
40
5
30
20
35
25
15
5
10
30
45
20
35
15
20
40
5
30
20
35
35
h)
(A*B)'
B'*A'
ans =
ans =
86
69
73
58
86
69
73
58
Algebra Lineal
5.- Introduzca las siguientes matrices:
B=[2;-6;-10]
A=
B=
-2.6000
-14.0000
12.0000
0 10.0000
0
0.2500 8.0000 10.0000
16.0000 -2.0000 6.0000
2
-6
-10
a)
M=A(2,3)
M=
8
b)
N=A(3,:)
N=
12 16
-2
c)
O=A(:,3)
O=
10
8
-2
d)
P=A(:,[1 3])
P=
-2.6000 10.0000
-14.0000 8.0000
12.0000 -2.0000
e)
Q=A([2 3],[1,2])
Q=
-14.0000 0.2500
12.0000 16.0000
f)
R=[A B]
R=
-2.6000
0
10.0000
0
2.0000
-14.0000 0.2500
8.0000 10.0000 -6.0000
12.0000 16.0000 -2.0000
6.0000 -10.0000
Algebra Lineal
g)
T=[Q;ones(2)]
T=
-14.0000 0.2500
12.0000 16.0000
1.0000 1.0000
1.0000 1.0000
h)
S=[P B,eye(3)]
S=
-2.6000 10.0000 2.0000
0
-14.0000 8.0000 -6.0000
0
12.0000 -2.0000 -10.0000
1.0000
1.0000
0
0
1.0000
A(3,:)
2*A(3,:)
ans =
ans =
12
16
-2
24
32
b)
A(2,:)
A(2)/4
ans =
ans =
-14.0000
0.2500
8.0000
10.0000
-3.5000
-4
12
Algebra Lineal
c)
A([2,3],:)
A([3 2],:)
ans =
ans =
-14.0000
12.0000
0.2500
16.0000
8.0000 10.0000
-2.0000 6.0000
d)
A(3,:)
ans =
12
16
-2
12.0000
-14.0000
16.0000
0.2500
-2.0000 6.0000
8.0000 10.0000