Documente Academic
Documente Profesional
Documente Cultură
2: Operaciones
con vectores y matrices
Table of Contents
Estudiantes ......................................................................................................................... 1
OPERACIONES CON VECTORES Y MARICES .................................................................... 1
Aplicacin de la tabla A-10 .................................................................................................. 2
1) Comando: eye ................................................................................................................ 2
2) Comando: ones ............................................................................................................... 2
3) Comando: zeros .............................................................................................................. 3
4) Comando: rand ............................................................................................................... 3
5) Comando: linspace .......................................................................................................... 3
6) Comando: A+B ............................................................................................................... 4
7) Comando: C^2 ................................................................................................................ 5
8) Comando: C*D ............................................................................................................... 5
9) Comando: E(x)=[] ........................................................................................................... 6
10) Comando: B=A ............................................................................................................ 6
11) Comando: u*v ............................................................................................................. 6
12) Comando: cross(u,v) ...................................................................................................... 7
13) Comando: det(x) ............................................................................................................ 7
14) Comando: Xi=inv(x) ...................................................................................................... 8
15) Comando: sort(x) ........................................................................................................... 8
16) Comando: -sort(-x) ........................................................................................................ 8
17) Comando: diag([ X1 X2 Xn ]) ...................................................................................... 9
18) Comando: A(X1, X2) = cte ............................................................................................. 9
19) Comando: A( :,2) = [] .................................................................................................... 9
20) Comando: A([1 3],:) = A([3 1],:) .................................................................................... 10
21) Comando: max(x),min(x),[valor, ubicacin] = max(x) ........................................................ 10
22) Aplicacin de MATLAB a circuitos elctricos .................................................................. 12
23) Resuelva en forma clara y ordenada con MATLAB ........................................................... 13
24) Grficos Bidimensionales .............................................................................................. 13
Estudiantes
Nombre:
Daniel David Daz Lpez 20141000845
Hansy Romero 20131014232
Seccin: Martes 12:00 M
Asignatura: IE-415
Fecha: 12-Abril-2016
UNAH - Facultad de Ingeniera Elctrica
A =
-2
4
1
7
ans =
4
ans =
1
ans =
-2
4
1
7
A =
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
2) Comando: ones
Operacin: Crea una matriz de unos
A=ones(4,5)
A =
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3) Comando: zeros
Operacin: Crea una matriz de ceros
A=zeros(4,5)
A =
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4) Comando: rand
Operacin: Crea un arreglo con nmeros aleatorios
A=rand(2,2)
A =
0.8147
0.9058
0.1270
0.9134
5) Comando: linspace
Operacin: Crea un vector con espaciado constante
A=linspace(1,1)
A =
Columns 1 through 13
1
1
1
Columns 14 through 26
1
Columns 27 through 39
1
1
1
Columns 40 through 52
1
1
Columns 53 through 65
1
1
Columns 66 through 78
1
1
Columns 79 through 91
1
1
Columns 92 through 100
1
6) Comando: A+B
Operacin: Suma de matrices
A=[-2 3;-4 5;-6 7]
B=[1 1;2 0;6 2]
A+B
A =
-2
-4
-6
3
5
7
1
2
6
1
0
2
B =
4
5
9
7) Comando: C^2
Operacin: Exponenciacin de matrices
C=[2 1;1 3]
C^2
C =
2
1
1
3
ans =
5
5
5
10
8) Comando: C*D
Operacin: Producto de matrices
C=[2 1;1 3]
D=[3 1;5 3]
C*D
C =
2
1
1
3
3
5
1
3
D =
ans =
11
18
5
10
9) Comando: E(x)=[]
Operacin: Eliminacin de un elemento
E=[3 13 5 0 8 90 76 54]
E(6)=[]
E =
3
13
90
76
13
76
54
E =
A =
1
5
2
1
2
7
3
1
3
-1
4
1
1
2
3
5
7
-1
2
3
4
B =
1
1
1
u =
1
54
v =
4
ans =
32
u =
1
-3
v =
ans =
-3
D =
3
5
1
3
ans =
4.0000
D =
3
5
1
3
Di =
0.7500
-1.2500
-0.2500
0.7500
A =
-2
5
-2
4
-6
-7
7
-4
-9
-7
-6
4
-9
-4
7
ans =
-2
-2
5
A =
1
5
2
1
2
7
3
1
3
-1
4
1
7
3
2
1
4
3
1
-1
ans =
5
2
1
1
ans =
1
0
0
0
3
0
0
0
-4
A =
2.0000
-4.0000
0.5000
-3.0000
5.0000
-7.0000
A =
2.0000
1.0000
0.5000
-3.0000
1.0000
-7.0000
A =
1
2
0
2
1
-3
A =
2
1
7
3
4
6
7
1
2
6
4
3
A =
10
ans =
-7
cual =
5
donde =
4
ans =
5
3
4
8
5
9
0
cual =
5
donde =
2
ans =
7
A =
1
3
6
7
6
7
B =
5
9
0
11
3
6
4
8
9
0
6
7
4
8
9
0
D =
E =
10
-43
6
12
16
6
-30
8
0
12
8
-34
B =
-20
0
12
-40
I =
0.8411
0.7206
0.6127
1.5750
12
A =
43
-18
-10
0
0
-18
-9
-9
-5
-2
-10
33
33
-14
0
0
-14
-14
40
8
0
0
0
-8
15
B =
38
0
-20
-24
-38
I =
-2.5000
-5.7215
-4.2514
-3.1287
-1.6276
13