Introduccion
Introduccion
2
5
3
6
size(A)
ans =
2
B=[7;8;9]
B =
7
8
9
size(B)
ans =
3
Bt=B'
Bt =
7
8
2
5
9
3
6
C=[Bt;A]
C =
7
1
4
C12=C(1,2)
C12 =
8
%Extraer todos los elementos, renglo o columna
vector3=C(:,3)
vector3 =
9
3
6
subc=C(2:3,1:2)
subc =
1
4
2
5
%operaciones de matrices
D=C+C
D =
14
2
8
E=C*B
16
4
10
18
6
12
E =
194
50
122
F=C^2
F =
93
21
57
117
27
72
141
33
87
1
2
3
4
5
6
G =C'
G =
7
8
9
H=inv(C)
{Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.541976e-018.}
H =
1.0e+016 *
-0.4504
0.9007
-0.4504
-0.4504
0.9007
-0.4504
0.9007
-1.8014
0.9007
H1=C^(-1)%inversa
{Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.541976e-018.}
H1 =
1.0e+016 *
-0.4504
0.9007
-0.4504
-0.4504
0.9007
-0.4504
0.9007
-1.8014
0.9007
15
18
16
19
13A=A*B
??? 13A=A*B
|
{Error: Unexpected MATLAB expression.
}
A_13=A*B
A_13 =
50
122
%division
J=D/C%D*inv(C)
{Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.156482e-018.}
J =
2
0
0
0
2
0
0
0
2
JJ=D\C%inv(D)*C
{Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.541976e-018.}
JJ =
0.5000
0
0
0.2500
0
0.2500
0
0
0.5000
vector3.^2
ans =
81
9
36
vector3.^B
ans =
4782969
6561
10077696
%Numeros complejos
x=3+5*i
x =
3.0000 + 5.0000i
Ai=[1,2;3,4]+i*[5,6;7,8]
Ai =
1.0000 + 5.0000i
3.0000 + 7.0000i
2.0000 + 6.0000i
4.0000 + 8.0000i
CDi=C+i*D
CDi =
7.0000 +14.0000i
1.0000 + 2.0000i
4.0000 + 8.0000i
8.0000 +16.0000i
2.0000 + 4.0000i
5.0000 +10.0000i
9.0000 +18.0000i
3.0000 + 6.0000i
6.0000 +12.0000i
1
14
2
15
3
16
4
17
Columns 22 through 26
21
t1=0:25
t1 =
22
23
24
5
18
25
6
19
7
20
10
11
12
Columns 1 through 21
0
13
1
14
15
16
17
5
18
6
19
10
11
12
20
Columns 22 through 26
21
22
23
24
25
t2=0:.5:25
t2 =
Columns 1 through 13
0
4.0000
0.5000
4.5000
1.0000
5.0000
1.5000
5.5000
2.0000
6.0000
2.5000
3.0000
3.5000
7.5000
11.5000
8.0000
12.0000
8.5000
12.5000
9.0000
9.5000
10.0000
14.5000
18.5000
15.0000
19.0000
15.5000
16.0000
16.5000
21.0000
25.0000
21.5000
22.0000
22.5000
23.0000
Columns 14 through 26
6.5000
10.5000
7.0000
11.0000
Columns 27 through 39
13.0000
17.0000
13.5000
17.5000
14.0000
18.0000
Columns 40 through 51
19.5000
23.5000
20.0000
24.0000
20.5000
24.5000
t3=-10:2:10
t3 =
-10
-8
-6
-4
-2
10
t4=10:-1:-5
t4 =
10
-3
9
-4
-1
-2
-5
t5=0:Pi/8:2*PI
{??? Undefined function or variable 'Pi'.
}
t5=0:Pi/8:2*Pi
{??? Undefined function or variable 'Pi'.
}
t5=0:pi/8:2*pi
t5 =
Columns 1 through 13
0
0.3927
0.7854
1.1781
1.5708
1.9635
2.3562
2.7489
3.1416
3.5343
3.9270
4.3197
5.8905
6.2832
4.7124
Columns 14 through 17
5.1051
5.4978
t6=0:.001:20000
size(t6)
ans =
1
20000001
%Aceros=zeros(n,m)
Aceros=zeros(3,2)
Aceros =
0
0
0
0
0
0
Aunos=ones(3,2)
Aunos =
1
1
1
1
1
1
Aidentidad=eye(3)
Aidentidad =
1
0
0
0
1
0
0
0
1
%funciones matematicas
cos(pi)
ans =
-1
sen(pi)
{??? Undefined function or method 'sen' for input arguments of type 'double'.
}
sin(pi)
ans =
1.2246e-016
sin(0)
ans =
0
3*exp(2)%3e^2
ans =
22.1672
%Grafica
%plot(eje x,eje y)
ejex=-2*pi:0.05:-pi*2;%definimos el eje
y=sin(ejex)
y =
2.4493e-016
plot(ejex,y)
grid
ejex=-2*pi:0.05:pi*2;%definimos el eje
plot(ejex,y)
ejex
ejex =
Columns 1 through 13
6.0668
6.1168
6.1668
6.2168
6.2668
0.0998
0.4794
0.1494
0.5227
0.1987
0.5646
y=sin(ejex)
y =
Columns 1 through 13
0.0000
0.3894
0.0500
0.4350
plot(ejex,y)
grid
title('Grafica sin(x)')
plot(ejex,y)
grid
title('Grafica sin(x)')
xlabel('eje x')
ylabel('eje y')
plot(ejex,cos(ejex))
hold on
%no borrar grafica
plot(ejex,y,'r')
diary off
0.2474
0.2955
0.3429