Академический Документы
Профессиональный Документы
Культура Документы
1
1. Use el comando help en la ventana de comandos para encontrar la sintaxis
>> sqrt(x)
ans =
Columns 1 through 2
0 + 1.4142i
0 + 1.0000i
Columns 3 through 4
0
1.0000
Column 5
1.4142
2. Encuentre la raz cuadrada de 23 y +3.
a. Use la funcin sqrt.
b. Use la funcin nthroot.
c. Eleve 23 y +3 a la potencia .
Cmo vara el resultado?
>> sqrt (-3)
ans =
0 + 1.7321i
>> sqrt (3)
ans =
1.7321
3. Cree un vector x de 210 a 11 con un incremento de 3.
a. Encuentre el resultado de x dividido entre 2.
b. Encuentre el residuo de x dividido entre 2.
>> x=-10:3:11
x =
Columns 1 through 7
-10
-7
-4
-1
2
5
8
Column 8
11
>> x/3
ans =
Columns 1 through 4
-3.3333
-2.3333
-1.3333
-0.3333
Columns 5 through 8
0.6667
1.6667
2.6667
>> rem (x,3)
ans =
Columns 1 through 7
-1
-1
-1
-1
2
Column 8
2
3.6667
0.0000
0.0000
0.2981
5.9874
1
+
3
+
5
through 2
3.1416i
1.9459 + 3.1416i
through 4
3.1416i
0 + 3.1416i
through 6
1.6094
7 through 8
2.3979
>> log10(x)
ans =
Columns 1
1.0000 +
Columns 3
0.6021 +
Columns 5
0.3010
Columns 7
0.9031
through 2
1.3644i
0.8451 + 1.3644i
through 4
1.3644i
0 + 1.3644i
through 6
0.6990
through 8
1.0414
6. Use la funcin sign para determinar cules de los elementos en el vector x son
positivos.
>> sign(x)
ans =
Columns 1 through 7
-1
-1
-1
-1
1
1
1
Column 8
1
7. Cambie el format a rat y muestre el valor del vector x dividido entre 2.
>> format rat
>> x/2
ans =
Columns 1 through
-5
Columns 3 through
-2
Columns 5 through
1
Columns 7 through
4
2
-7/2
-1/2
6
8
5/2
11/2
theta=3*pi;
sin(2*theta)
ans =
-1/1360936612766281
2. cos(u) para 0 u 2p; sea u que cambia en pasos de 0.2p.
>> theta=0:0.2*pi:2*pi;
>> cos(theta)
ans =
Columns 1 through 2
1
1292/1597
Columns 3 through 4
305/987
-305/987
Columns 5 through 6
-1292/1597
-1
Columns 7 through 8
-1292/1597
-305/987
Columns 9 through 10
305/987
1292/1597
Column 11
1
3. sen21(1).
>> asin(1)
ans =
355/226
4. cos21(x) para 21 x 1; sea x que cambia en pasos de 0.2.
>> acos(x)
ans =
Column 1
355/113
- 883/295i
Column 2
355/113
- 1957/743i
Column 3
355/113
- 1789/867i
Column 4
355/113
Column 5
0
+ 831/631i
Column 6
0
+ 1121/489i
Column 7
0
+ 371/134i
Column 8
0
+ 868/281i
5. Encuentre el coseno de 45.
>> cos(45*pi/180)
ans =
985/1393
a. Convierta el ngulo de grados a radianes y luego use la
funcin cos.
>> cos(45*pi/180)
ans =
985/1393
b. Use la funcin cosd.
>> cosd(45)
ans =
985/1393
6. Encuentre el ngulo cuyo seno es 0.5. Su respuesta est en grados o radianes?
>> asin(0.5)
ans =
355/678
>> asind(0.5)
ans =
30
7. Encuentre la cosecante de 60 grados. Es posible que tenga que usar la funcin help
para encontrar la sintaxis adecuada.
>> csc(60*pi/180)
ans =
1351/1170
>> cscd(60)
ans =
1351/1170
Ejercicio de prctica
3.6
>> sortrows(x)
ans =
Columns 1 through 2
1
84
2
55
3
78
4
90
Columns 3 through 4
92
93
65
75
82
79
85
75
ans =
Columns 1 through 2
1921/1488
5265/344
Columns 3 through 4
3014/263
1068/125
2. Encuentre la varianza para cada columna.
>> var(x)
ans =
Columns 1 through 2
507/6088
93/1094
Columns 3 through 4
341/4225
119/1469
Column 5
129/1972
3. Calcule la raz cuadrada de la varianza que encontr para cada columna.
>> sqrt(var(x))
ans =
Columns 1 through 2
187/648
235/806
Columns 3 through 4
777/2735
816/2867
Column 5
122/477
4. Cmo se comparan los resultados del problema 3 contra la desviacin estndar que
encontr en el problema 1?
Comparando la raz cuadrada de la varianza es igual a la
desviacin estndar
Columns 3 through 4
659/7520
238/3425
Column 5
93/1123
>> mean(x)
ans =
Columns 1 through 2
573/1078
3261/6944
Columns 3 through 4
1060/2289
85/198
Column 5
583/1151
5. Cree una matriz 100 3 5 de nmeros aleatorios distribuidos de manera normal.
Asegrese de suprimir la salida.
>> x=randn(100,5);
6. Encuentre el mximo, la desviacin estndar, la varianza y la media para cada
columna en la matriz que cre en el problema 5.
>> max(x)
ans =
Columns 1 through 2
1346/489
811/275
Columns 3 through 4
800/293
999/410
Column 5
2766/1165
>> std(x)
ans =
Columns 1 through 2
1133/1035
513/505
Columns 3 through 4
1286/1321
821/920
Column 5
1861/1842
>> var(x)
ans =
Columns 1 through 2
1154/963
1648/1597
Columns 3 through 4
5383/5680
2233/2804
Column 5
1969/1929
>> mean(x)
ans =
Columns 1 through 2
187/2264
115/2177
Columns 3 through 4
214/643
95/8034
Column 5
-849/5396
>> A=1+i
A =
1
+
1i
>> B=2-3i
B =
2
3i
>> C=8+2i
C =
8
+
2i
2. Cree un vector D de nmeros complejos cuyos componentes
reales son 2, 4 y 6 y cuyos componentes imaginarios son 23,
8 y 216.
>> imagD=[-3,8,-16];
>> realD=[2,4,6];
>> D=complex(realD,imagD)
D =
Column 1
2
3i
Column 2
4
+
8i
Column 3
6
16i
3. Encuentre la magnitud (valor absoluto) de cada uno de los
vectores que cre en los problemas 1 y 2.
>> abs(A)
ans =
1393/985
>> abs(B)
ans =
4936/1369
>> abs(C)
ans =
2177/264
>> abs(D)
ans =
Columns 1 through 2
4936/1369
2889/323
Column 3
2136/125
4. Encuentre el ngulo desde la horizontal de cada uno de los
nmeros complejos que cre en los problemas 1 y 2.
>> angle(A)
ans =
355/452
>> angle(B)
ans =
-971/988
>> angle(C)
ans =
805/3286
>> angle(D)
ans =
Columns 1 through 2
-971/988
6737/6085
Column 3
-383/316
5. Encuentre la conjugada compleja del vector D.
>> conj(D)
ans =
Column 1
2
+
3i
Column 2
4
8i
Column 3
6
+
16i
6. Use el operador transpuesto para encontrar la conjugada
compleja del vector D.
>> D'
ans =
2
+
3i
4
8i
6
+
16i
7. Multiplique A por su conjugada compleja y luego saque la
raz cuadrada de su respuesta. Cmo se compara este valor
contra la magnitud (valor absoluto) de A?
>> sqrt(A.*A')
ans =
1393/985
su
de
y
un
>> a = [12 17 3 6]
a =
Columns 1 through 2
12
17
Columns 3 through 4
3
6
>> b = [5 8 3; 1 2 3; 2 4 6]
b =
Columns 1 through 2
5
8
1
2
2
4
Column 3
3
3
6
>> c = [22;17;4]
c =
22
17
4
1. Asigne a la variable x1 el valor en la segunda
columna de la matriz a. En ocasiones, esto se
representa en los libros de matemticas como el
elemento a1,2 y se podra expresar como x1 = a1,2.
>> x1 = a(1,2)
x1 =
17
2. Asigne a la variable x2 la tercera columna de la
matriz b.
>> x2 = b(:,3)
x2 =
3
3
6
3. Asigne a la variable x3 la tercera fila de la matriz
b
>> x3 = b(3,:)
x3 =
Columns 1 through 2
2
4
Column 3
6
5
1
2
8
2
4
3
3
6
246326/121
42977/19
Column 5
126669/28
331149/61
69668/11
94097/13
*
126669/14
41224/9
106877/21
Ejercicio de prctica
1. Cree una matriz 3 x
>> zeros(3)
ans =
Columns 1 through
0
0
0
Column 3
0
0
0
2. Cree una matriz 3 x
>> zeros(3,4)
ans =
Columns 1 through
0
0
0
Columns 3 through
0
0
0
3. Cree una matriz 3 x
>> ones(3)
ans =
Columns 1 through
1
1
1
4.3
3 de ceros.
2
0
0
0
4 de ceros.
2
0
0
0
0
0
0
3 de unos.
2
1
1
1
Column 3
1
1
1
4. Cree una matriz 5 x 3 de unos.
>> ones(5,3)
ans =
Columns 1 through 2
1
1
1
1
1
1
1
1
1
1
Column 3
1
1
1
1
1
25
2
76
83
82
89
13
95
94
96
100
77
Columns 5 through 6
15
67
16
73
22
54
3
60
9
61
90
42
91
48
97
29
78
35
84
36
Columns 7 through
74
51
55
57
56
63
62
69
68
75
49
26
30
32
31
38
37
44
43
50
Columns 9 through 10
58
40
64
41
70
47
71
28
52
34
33
65
39
66
45
72
46
53
27
59
a. Extraiga la diagonal de esta matriz.
>> diag(x)
ans =
92
80
88
21
9
42
30
38
46
59
la
>>
>>
>>
>>
hold on
r=4*cos(6*theta);
polar(theta,r)
title('Poder floral')
>> figure(2)
>> r=5-5*sin(theta);
>> polar(theta,r)
>>
>>
>>
>>
figure(4)
theta = pi/2:4/5*pi:4.8*pi;
r=ones(1,6);
polar(theta,r)
>> figure(2)
>> x=-1:0.1:1;
>> y=3*x.^2;
>> subplot(2,2,1)
>> plot(x,y)
>> title('Coordenadas rectangulares')
>> ylabel('eje y')
>> grid on
>> subplot(2,2,2)
>> semilogx(x,y)
Warning: Negative data ignored
Warning: Negative data ignored
>> title('Sistema coordenado semilog x')
Warning: Negative data ignored
>> grid on
Warning: Negative data ignored
>> subplot(2,2,3)
>> semilogy(x,y)
>> title('Sistema coordenado semilog y')
>> ylabel('eje y')
Warning: Negative data ignored
>> xlabel('eje x')
Warning: Negative data ignored
>> grid on
>> subplot(2,2,4)
>> loglog(x,y)
Warning: Negative data ignored
>> title('Grfica log')
Warning: Negative data ignored
>> xlabel('eje x')
Warning: Negative data ignored
Warning: Negative data ignored
Warning: Negative data ignored
>> grid on
Warning: Negative data ignored
>> figure(3)
>> x=-1:0.1:1;
>> y=12*exp(x+2);
>> subplot(2,2,1)
>> plot(x,y)
>> title('Coordenadas rectangulares')
>> ylabel('eje y')
>> grid on
>> subplot(2,2,2)
>> semilogx(x,y)
Warning: Negative data ignored
Warning: Negative data ignored
>> title('Sistema coordenado semilog x')
Warning: Negative data ignored
>> grid on
Warning: Negative data ignored
>> subplot(2,2,3)
>> semilogy(x,y)
>> title('Sistema coordenado semilog y')
>> ylabel('eje y')
>> xlabel('eje x')
Warning: Negative data ignored
>> grid on
>> subplot(2,2,4)
>> loglog(x,y)
Warning: Negative data ignored
>> title('Grfica Log')
Warning: Negative data ignored
>> xlabel('eje x')
Warning: Negative data ignored
Warning: Negative data ignored
Warning: Negative data ignored
>> grid on
Warning: Negative data ignored
>>
>>
>>
>>
>>
>>
>>
figure(4)
x=-1:0.01:1;
y=1./x;
subplot(2,2,1)
plot(x,y)
title('Coordenadas rectangulares')
ylabel('eje y')
>> grid on
>> subplot(2,2,2)
>> semilogx(x,y)
Warning: Negative data ignored
Warning: Negative data ignored
>> title('Sistema coordenado semilog x')
Warning: Negative data ignored
>> grid on
Warning: Negative data ignored
>> subplot(2,2,3)
>> semilogy(x,y)
Warning: Negative data ignored
>> title('Sistema coordenado semilog y')
Warning: Negative data ignored
>> ylabel('eje y')
Warning: Negative data ignored
>> xlabel('eje x')
Warning: Negative data ignored
Warning: Negative data ignored
Warning: Negative data ignored
>> grid on
Warning: Negative data ignored
>> subplot(2,2,4)
>> loglog(x,y)
Warning: Negative data ignored
Warning: Negative data ignored
>> title('Grfica Log')
Warning: Negative data ignored
Warning: Negative data ignored
>> xlabel('eje x')
Warning: Negative data ignored
Warning: Negative data ignored
Warning: Negative data ignored
Warning: Negative data ignored
Warning: Negative data ignored
Warning: Negative data ignored
>> grid on
Warning: Negative data ignored
Warning: Negative data ignored
1.
>>
>>
>>
>>
fplot('5*t^2',[-3,+3])
title('5*t^2')
xlabel('eje x')
ylabel('eje y')
2.
>> fplot('t*exp(t)',[0,10])
>> title('t*exp(t)')
>> xlabel('eje x')
>> ylabel('eje y')
y=( x )=x 2
function output = quad(x)
output = x.^2;
9.
y ( x ) =e1 / x
function output=one_over(x)
output = exp(1./x);
10. y ( x ) =sen ( x 2 )
function output = sin_x_squared(x)
output = sin(x.^2);
12.Caloras a joules
function result=cal_to_joules(x)
result = 4.2.*x;
13.Watts a BTU/h
function output = Watts_to_Btu_per_hour(x)
output = x.*3.412;
14.Metros a millas
function output = meters_to_miles(x)
output = x./1000.*.6214;
17. z ( a ,b ,c ) =a bc
function output = z2(a,b,c)
% encuentra a.*b.^c
% las dimensiones de la matriz deben concordar
output = a.*b.^c;
18. z ( w , x , y )=w e y
function output = z3(w,x,y)
% encuentra w.*exp(x./y)
% las dimensiones de la matriz deben concordar
output = w.*exp(x./y);
19. z ( p , t ) =p /sen ( t )
function output = z4(p,t)
% encuentra p./sin(t)
% las dimensiones de la matriz deben concordar
output = p./sin(t);
f ( x )=sen ( x )
function [a,b]=f5(x)
a = cos(x);
b = sin(x);
21. f ( x )=5 x 2+ 2
f ( x )= 5 x 2+2
function [a,b] = f6(x)
a = 5.*x.^2 + 2;
b = sqrt(5.*x.^2 + 2);
22. f ( x )=exp ( x )
f ( x )=( x )
function [a,b] = f7(x)
a = exp(x);
b = log(x);
f ( x , y ) =x y
function [a,b] = f8(x,y)
a = x+y;
b = x-y;
24.
f ( x , y ) = y ex
f ( x , y ) =x e y
function [a,b] = f9(x,y)
a = y.*exp(x);
b = x.*exp(y);
A=
1
2
Base altura
V = r 2 h
r = input('Ingrese el radio del cilindro: ');
h = input('Ingrese la altura del cilindro: ');
Volume = pi*r.^2*h
Conmine al usuario a ingresar los valores de r y h.
Enter the radius of the cylinder: 2
Enter the height of the cylinder: 3
Volume =
37.6991
A=
1
2
Base altura
V = r 2 h
r = input('Ingrese el radio del cilindro: ');
h = input('Ingrese la altura del cilindro: ');
Volume = pi*r.^2*h
Conmine al usuario a ingresar los valores de r y h.
Enter the radius of the cylinder: 2
Enter the height of the cylinder: 3
Volume =
37.6991
Pies
0.00
10
0.83
20
1.67
30
2.50
40
3.33
50
4.17
60
5.00
70
5.83
80
90
6.67
7.50
100
8.33
110
9.17
120
10.00