Escolar Documentos
Profissional Documentos
Cultura Documentos
1
1. Use el comando help en la ventana de comandos para encontrar la sintaxis adecuada para
las siguientes funciones:
a. >> help cos
COS Cosine of argument in radians.
COS(X) is the cosine of the elements of X.
See also acos, cosd.
Overloaded methods:
codistributed/cos
Reference page in Help browser
doc cos
b. >> help sqrt
SQRT Square root.
SQRT(X) is the square root of the elements of X. Complex
results are produced if X is not positive.
See also sqrtm, realsqrt, hypot.
Overloaded methods:
codistributed/sqrt
Reference page in Help browser
doc sqrt
c. >> help exp
EXP Exponential.
EXP(X) is the exponential of the elements of X, e to the X.
For complex Z=X+i*Y, EXP(Z) = EXP(X)*(COS(Y)+i*SIN(Y)).
See also expm1, log, log10, expm, expint.
Overloaded methods:
lti/exp
codistributed/exp
fints/exp
xregcovariance/exp
Reference page in Help browser
doc exp
Ejercicio de prctica 3.2
1. Cree un vector x de -2 a +2 con un incremento de 1. Su vector debe ser
>> sqrt(x)
ans =
Columns 1 through 2
0 + 1.4142i
0 + 1.0000i
Columns 3 through 4
0
1.0000
Column 5
1.4142
1. 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
2. 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 3.6667
>> rem (x,3)
ans =
Columns 1 through 7
-1 -1 -1 -1 2 2 2
Column 8
2
3. Use el vector del problema 3 y encuentre ex.
>> exp(x)
ans =
1.0e+004 *
Columns 1 through 4
0.0000 0.0000 0.0000 0.0000
Columns 5 through 8
0.0007 0.0148 0.2981 5.9874
4. Use el vector del problema 3.
a. Encuentre ln(x) (el logaritmo natural de x).
b. Encuentre log10(x) (el logaritmo comn de x).
Explique sus resultados.
>> log(x)
ans =
Columns 1 through 2
2.3026 + 3.1416i 1.9459 + 3.1416i
Columns 3 through 4
1.3863 + 3.1416i
0 + 3.1416i
Columns 5 through 6
0.6931
1.6094
Columns 7 through 8
2.0794
2.3979
>> log10(x)
ans =
Columns 1 through 2
1.0000 + 1.3644i 0.8451 + 1.3644i
Columns 3 through 4
0.6021 + 1.3644i
0 + 1.3644i
Columns 5 through 6
0.3010
0.6990
Columns 7 through 8
0.9031
1.0414
5. 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 2
-5
-7/2
Columns 3 through 4
-2
-1/2
Columns 5 through 6
1
5/2
Columns 7 through 8
4
11/2
Ejercicio de prctica 3.3
1. Factorice el nmero 322
>> Factor (322)
ans =
2 7 23
2. Encuentre el mximo comn denominador de 322 y 6.
>> gcd(322,6)
ans =
2
3. 322 es nmero primo?
>> primes(322)
ans =
0
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
1. 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
2. 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
3. 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
4. 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.5
Considere la siguiente matriz:
3
78
1
84
Columns 3 through 4
85
75
65
75
82
79
92
93
1. Cul es el valor mximo en cada columna?
>> max(x)
ans =
Columns 1 through 2
4
90
Columns 3 through 4
92
93
2. En cul fila se presenta dicho mximo?
>> [maximum, row]=max(x)
maximum =
Columns 1 through 2
4
90
Columns 3 through 4
92
93
row =
Columns 1 through 2
1
1
Columns 3 through 4
4
4
3. Cul es el valor mximo en cada fila? (Tendr que transponer la matriz para
responder esta pregunta.)
>> max(x')
ans =
Columns 1 through 2
90
75
Columns 3 through 4
82
93
4. En cul columna ocurre el mximo?
>> [maximum, column]=max(x')
maximum =
Columns 1 through 2
90
75
Columns 3 through 4
82
93
column =
Columns 1 through 2
2
4
Columns 3 through 4
3
4
5. Cul es el valor mximo en toda la tabla?
>> max(max(x))
ans =
93
76.7500
81.0000
80.5000
81.0000
83.5000
77.0000
>> mean(x')
ans =
63.5000
49.2500
60.5000
67.5000
4. Cul es la mediana para cada fila? Cul es la mediana para toda la matriz?
>> median(x')
ans =
80.0000
60.0000
78.5000
88.0000
55
65
75
78
82
75
84
85
79
90
92
93
90
84
78
55
92
85
82
65
93
79
75
75
>> sortrows(x)
ans =
1
2
3
4
84
55
78
90
92
65
82
85
93
75
79
75
ans =
1.2910
15.3052
11.4601
8.5440
234.2500
131.3333
73.0000
15.3052
11.4601
8.5440
0.9134
0.2785
0.9058
0.6324
0.5469
0.1270
0.0975
0.9575
randn(3)
ans =
2.7694
0.7254
-0.2050
-1.3499
-0.0631
-0.1241
3.0349
0.7147
1.4897
x=rand(100,5);
max(x)
ans =
0.9961
0.9619
0.9880
0.9991
0.9937
0.2838
0.2843
0.2821
0.2579
>> std(x)
ans =
0.2854
>> var(x)
ans =
0.0814
0.0805
0.0808
0.0796
0.0665
>> mean(x)
ans =
0.5082
0.4658
0.5080
0.4754
0.4999
2.5088
2.7891
2.6052
3.5267
>> std(x)
ans =
0.9283
0.9743
1.0061
0.9682
1.0162
>> var(x)
ans =
0.8618
0.9493
1.0123
0.9373
1.0326
-0.0908
-0.1185
-0.2511
0.1266
>> mean(x)
ans =
0.0815
>> A=1+i
A =
1.1
+ 1.0000i
>> B=2-3i
B =
1.2
- 3.0000i
>> C=8+2i
C =
8.0000 + 2.0000i
ans =
8.2462
>> abs(D)
ans =
3.6056
8.9443
17.0880
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 =
0.7854
>> angle(B)
ans =
-0.9828
>> angle(C)
ans =
0.2450
>> angle(D)
ans =
-0.9828
1.1071
-1.2120
4.0000 - 8.0000i
6.0000 +16.0000i
ans =
2.0000 + 3.0000i
4.0000 - 8.0000i
6.0000 +16.0000i
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 =
1.4142
>> 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
6.
4
a. Asigne a la variable x1 el valor en la segunda columna de la matriz a. En ocasiones,
6
f. Asigne a la variable x6 los valores en la matriz c como la primera columna, los
valores en la matriz b como las columnas 2, 3 y 4, y los valores en la matriz a como
la ltima fila.
>> x6 = [c,b;a]
x6 =
Columns 1 through 2
22
5
17
1
4
2
12
17
Columns 3 through 4
8
3
2
3
4
6
3
6
g. Asigne a la variable x7 el valor del elemento 8 en la matriz b, use el esquema de
identificacin de nmero de ndice sencillo.
>> x7=b(8)
x7 =
3
h. Convierta la matriz b en un vector columna llamado x8.
x8=b(:)
x8 =
5
1
2
8
2
4
3
3
6
42977/19
Column 5
126669/28
331149/61
69668/11
94097/13
*
126669/14
106877/21
Column 3
1
1
1
6. 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
7. Cree una matriz 4 x 6 en la que todos los elementos tengan un valor de pi.
>> ones(4,6)*pi
ans =
Columns 1 through 2
355/113
355/113
355/113
355/113
355/113
355/113
355/113
355/113
Columns 3 through 4
355/113
355/113
355/113
355/113
355/113
355/113
355/113
355/113
Columns 5 through 6
355/113
355/113
355/113
355/113
355/113
355/113
355/113
355/113
8. Use la funcin diag para crear una matriz cuya diagonal tenga valores de 1, 2, 3.
>> x = [1,2,3];
>> diag(x)
ans =
Columns 1 through 2
1
0
0
2
0
0
Column 3
0
0
3
9. Cree una matriz mgica 10 x 10.
>> x = magic(10)
x=
Columns 1 through 2
92
99
98
80
4
81
85
87
86
93
17
24
23
5
79
6
10
12
11
18
Columns 3 through 4
1
8
7
14
88
20
19
21
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
b. Extraiga la diagonal que corre de inferior izquierda a superior derecha de esta
matriz.
>> diag(fliplr(x))
ans =
40
64
63
62
61
90
89
13
12
11
c. Confirme que la suma de las filas, columnas y diagonales son todas iguales.
>> sum(x)
ans =
Columns 1 through 2
505
505
Columns 3 through 4
505
505
Columns 5 through 6
505
505
Columns 7 through 8
505
505
Columns 9 through 10
505
505
>> sum(x')
ans =
Columns 1 through 2
505
505
Columns 3 through 4
505
505
Columns 5 through 6
505
505
Columns 7 through 8
505
505
Columns 9 through 10
505
505
>> sum(diag(x))
ans =
505
>> sum(diag(fliplr(x)))
ans =
505
2. Grafique x contra y para y = sen(x). Sea x que vara desde 0 hasta 2p en incrementos
de 0.1p.
>> x=0:0.1*pi:2*pi;
>> y=sin(x);
>> plot(x,y)
2. Grafique x contra y1 y y2 para y1 = sen(x) y y2 = cos(x). Sea x que vara desde 0 hasta 2p
enincrementos de 0.1p. Agregue un ttulo y etiquete su grfica.
>> figure(2)
>> y1=sin(x);
>> y2=cos(x);
>> plot(x,y1,x,y2)
>> title('Grficas seno y coseno')
>> xlabel('valores x')
>> ylabel('valores y')
3. Vuelva a crear la grfica de la parte 3, pero haga la lnea sen(x) rayada y roja.
Haga la lnea cos(x) verde y punteada.
>> figure(3)
>> plot(x,y1,'-- r',x,y2,': g')
>> title('Grficas seno y coseno')
>> xlabel('valores x')
>> ylabel('valores y')
5. Cree un nuevo vector, a = cos(x). Sea x que vara desde 0 hasta 2p en incrementos
de 0.1p. Grafique slo a (plot(a)) y observe el resultado. Compare este resultado con
la grfica que se produce al graficar x contra a (plot(x,a)).
>>
>>
>>
>>
axis([-1,2*pi+1,-1.5,1.5])
figure(4)
a=cos(x);
plot(a)
>> 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)
Rectangular
Semilogx
Semilogy
loglog
Usualmente, los datos fsicos se grafican de modo que caen en una lnea recta. Cul
de los tipos de grficas precedentes resultan en una lnea recta para cada problema?
>> figure(1)
>> x=-1:0.1:1;
>> y=5*x+3;
>> 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
Warning: Negative data ignored
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
>> 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
5.
>> fplot('5*t^2',[-3,+3])
>> title('5*t^2')
>> xlabel('eje x')
>> ylabel('eje y')
6.
>> fplot('t*exp(t)',[0,10])
>> title('t*exp(t)')
>> xlabel('eje x')
>> ylabel('eje y')
>> 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
7.
4
i. 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
j. Asigne a la variable x2 la tercera columna de la matriz b.
>> x2 = b(:,3)
x2 =
3
3
6
k. 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
l. Asigne a la variable x4 los valores en la matriz b a lo largo de la diagonal (es decir:
elementos b1,1, b2,2 y b2,3).
3
p. Convierta la matriz b en un vector columna llamado x8.
x8=b(:)
x8 =
5
1
2
8
2
4
3
3
6
0
0
0
11. Cree una matriz 3 x 4 de ceros.
>> zeros(3,4)
ans =
Columns 1 through 2
0
0
0
0
0
0
Columns 3 through 4
0
0
0
0
0
0
12. Cree una matriz 3 x 3 de unos.
>> ones(3)
ans =
Columns 1 through 2
1
1
1
1
1
1
Column 3
1
1
1
13. 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
14. Cree una matriz 4 x 6 en la que todos los elementos tengan un valor de pi.
>> ones(4,6)*pi
ans =
Columns 1 through 2
355/113
355/113
355/113
355/113
355/113
355/113
355/113
355/113
Columns 3 through 4
355/113
355/113
355/113
355/113
355/113
355/113
355/113
355/113
Columns 5 through 6
355/113
355/113
355/113
355/113
355/113
355/113
355/113
355/113
15. Use la funcin diag para crear una matriz cuya diagonal tenga valores de 1, 2, 3.
>> x = [1,2,3];
>> diag(x)
ans =
Columns 1 through 2
1
0
0
2
0
0
Column 3
0
0
3
16. Cree una matriz mgica 10 x 10.
>> x = magic(10)
x=
Columns 1 through 2
92
99
98
80
4
81
85
87
86
93
17
24
23
5
79
6
10
12
11
18
Columns 3 through 4
1
8
7
14
88
20
19
21
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
b. Extraiga la diagonal que corre de inferior izquierda a superior derecha de esta
matriz.
>> diag(fliplr(x))
ans =
40
64
63
62
61
90
89
13
12
11
c. Confirme que la suma de las filas, columnas y diagonales son todas iguales.
>> sum(x)
ans =
Columns 1 through 2
505
505
Columns 3 through 4
505
505
Columns 5 through 6
505
505
Columns 7 through 8
505
505
Columns 9 through 10
505
505
>> sum(x')
ans =
Columns 1 through 2
505
505
Columns 3 through 4
505
505
Columns 5 through 6
505
505
Columns 7 through 8
505
505
Columns 9 through 10
505
505
>> sum(diag(x))
ans =
505
>> sum(diag(fliplr(x)))
ans =
505
2. Grafique x contra y1 y y2 para y1 = sen(x) y y2 = cos(x). Sea x que vara desde 0 hasta 2p
enincrementos de 0.1p. Agregue un ttulo y etiquete su grfica.
>> figure(2)
>> y1=sin(x);
>> y2=cos(x);
>> plot(x,y1,x,y2)
>> title('Grficas seno y coseno')
>> xlabel('valores x')
>> ylabel('valores y')
3. Vuelva a crear la grfica de la parte 3, pero haga la lnea sen(x) rayada y roja.
Haga la lnea cos(x) verde y punteada.
>> figure(3)
>> plot(x,y1,'-- r',x,y2,': g')
>> title('Grficas seno y coseno')
>> xlabel('valores x')
>> ylabel('valores y')
5. Cree un nuevo vector, a = cos(x). Sea x que vara desde 0 hasta 2p en incrementos
de 0.1p. Grafique slo a (plot(a)) y observe el resultado. Compare este resultado con
la grfica que se produce al graficar x contra a (plot(x,a)).
>>
>>
>>
>>
axis([-1,2*pi+1,-1.5,1.5])
figure(4)
a=cos(x);
plot(a)
i.
>> hold on
>> r=4*cos(6*theta);
>> polar(theta,r)
>> title('Poder floral')
j.
>> figure(2)
>> r=5-5*sin(theta);
>> polar(theta,r)
l.
>> figure(4)
>> theta = pi/2:4/5*pi:4.8*pi;
>> r=ones(1,6);
>> polar(theta,r)
Usualmente, los datos fsicos se grafican de modo que caen en una lnea recta. Cul
de los tipos de grficas precedentes resultan en una lnea recta para cada problema?
>> figure(1)
>> x=-1:0.1:1;
>> y=5*x+3;
>> 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
Warning: Negative data ignored
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
>> 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')
>> 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
7.
>> fplot('5*t^2',[-3,+3])
>> title('5*t^2')
>> xlabel('eje x')
>> ylabel('eje y')
8.
>> fplot('t*exp(t)',[0,10])
>> title('t*exp(t)')
>> xlabel('eje x')
>> ylabel('eje y')
Cree funciones MATLAB para evaluar las siguientes funciones matemticas (asegrese de
seleccionar nombres de funcin significativos):
2.
( )
function output = quad(x)
output = x.^2;
3.
( )
function output=one_over(x)
output = exp(1./x);
4.
( )
Cree funciones MATLAB para las siguientes conversiones de unidades (es posible que
necesite consultar un manual o Internet para los factores de conversin adecuados):
5. Pulgadas a pies
function result = in_to_ft(x)
result = x./12;
6. Caloras a joules
function result=cal_to_joules(x)
result = 4.2.*x;
7. Watts a BTU/h
function output = Watts_to_Btu_per_hour(x)
output = x.*3.412;
8. Metros a millas
function output = meters_to_miles(x)
output = x./1000.*.6214;
10. (
11. (
% encuentra a.*b.^c
% las dimensiones de la matriz deben concordar
output = a.*b.^c;
12. (
13. (
( )
Si supone que las dimensiones de la matriz concuerdan, cree y ponga a prueba funciones
MATLAB para evaluar las siguientes funciones matemticas simples con un vector de
entrada sencilla y vectores de salida mltiple:
14. ( )
( )
( )
function [a,b]=f5(x)
a = cos(x);
b = sin(x);
15. ( )
( )
( )
16. ( )
( )
( )
( )
)
(
18.
)
(
tringulo: ');
h = input('Ingrese la altura del tringulo: ');
Area = 1/2*b*h
vector =
0123
22. Cree un vector que comience en a, termine en b y tenga un espaciamiento de c.
Permita al usuario ingresar todos estos parmetros.
a = input('Ingrese el valor inicial: ');
b = input('Ingrese el valor final: ');
c = input('Ingrese el espaciamiento del vector: ');
vector = a:c:b
Enter the starting value: 0
Enter the ending value: 6
Enter the vector spacing: 2
vector =
0246
23. Use el comando disp para crear un ttulo para una tabla que convierte pulgadas a pies.
disp('Tabla de conversin de pulgadas a pies')
24. Use el comando disp para crear encabezados de columna para su tabla.
disp(' Pulgadas Pies')
25. Cree un vector inches desde 0 hasta 120 con un incremento de 10.
inches = 0:10:120;
Calcule los correspondientes valores de feet.
feet = inches./12;
Agrupe el vector inch y el vector feet en una matriz table.
table = [inches; feet];
Use el comando fprintf para enviar su tabla a la ventana de comandos.
Tabla de conversin de pulgadas a pies
Pulgadas
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
6.67
90
7.50
100
8.33
110
9.17
120
10.00