Documentos de Académico
Documentos de Profesional
Documentos de Cultura
ALUMNO
Lucas Huaman Jonathan
CDIGO
08190017
A=
2
3 -7
1 -1
dimensiones
>> size(A)
ans =
3
Traza
>> A(1,1)+A(2,2)+A(3,3)
ans =
6
Determinante
>> det(A)
ans =
-32
La inversa
>> B=1\A
B=
2
3 -7
1 -1
A=
2
2
1
3 -7
1 -1
2 3
C=
2 -7
1
>> A=[1:11; 2:12; 3:13; 4:14; 5:15; 6:16; 7:17; 8:18; 9:19; 10:20; 11:21]
A=
1
9 10 11
9 10 11 12
9 10 11 12 13
9 10 11 12 13 14
9 10 11 12 13 14 15
9 10 11 12 13 14 15 16
9 10 11 12 13 14 15 16 17
9 10 11 12 13 14 15 16 17 18
9 10 11 12 13 14 15 16 17 18 19
10 11 12 13 14 15 16 17 18 19 20
11 12 13 14 15 16 17 18 19 20 21
>> B=magic(12)
144
3 141 140
8 138 139
4 142 143
>> C=pascal(12)
1
10
11
10
15
21
28
36
45
55
66
10
20
35
56
84
120
165
220
286
15
35
70
126
210
330
495
715
1001
21
56
126
252
462
792
1287
2002
12
78
364
1365
4368
3003
1
12376
28
84
210
462
924
1716 3003
5005
1716
3432 6435
11440
1
19448
8
31824
36
120
330
792
1
43758
9
75582
45
165
495
1287 3003
1
92378
10
167960
55
220
715
1
184756
11
352716
66
286
1001
1
352716
12
705432
78
364
1365
13
3 119 3
5 39 10
7 93 35
9 65 126
11 67 462
13 91 1716
15 41 6435
17 117 24310
19 15
92378
21 143 352716
8008
A=
5 -4
-4
6 -4
6 -4
6 -4
6 -4
1 -4
0
1 -4
1 -4
1 -4
6 -4
1 -4
A=
0
3 -4
3 -4
3 -4
3 -4
-4
2 -4
2 -4
2 -4
2 -4
2 -4
2 -4
3 -4
>> A=[2,3,-4;1,-2,1;1,-7,14]
A=
>> b=[3,0,2]'
2 3 -4
1 -2 1
1 -7 14
b=
>> X=A\b
3
0
2
X=
1.1967
0.8361
0.4754
X1 +X2 +0X3+3X4 = 4
2X1 +X2 -X3+X4 = 1
3X1 -X2 -X3+2X4 = -3
-X1 +2X2 +3X3-X4 = 4
>> A=[1,1,0,3;2,1,-1,3,-1,-1,2;-1,2,3,-1]
A=
1
2
1 0
1 -1
3
1
>> b=[4,1,-3,4]'
3 -1 -1 2
-1 2 3 -1
b=
>> X=A\b
4
1
-3
4
X=
-1.0000
2.0000
-0.0000
1.0000
Siendo b ==>
( )
( )
A=
1 2 0 1
2 4 1 1
-1 -5 0 0
1 5 2 1
b1 =
>>x1=A\b1
1
0
1
0
x1 =
-0.4444
-0.1111
-0.3333
1.6667
b2 =
>> x2=A\b2
1
2
3
4
x2 =
-0.2222
-0.5556
2.3333
2.3333
b3 =
>> x3=A\b3
-1
0
2
-3
x3 =
2.4444
-0.8889
0.3333
-1.6667
B=
-1
2
0
5
b1 =
>>x4=B\b1
1
0
1
0
x4 =
0.8333
0.0556
1.3333
-2.0000
b2 =
3 2 0.5
-6 -1 0
6 2 1
-3 0 2
>> x5=B\b2
1
2
3
4
x5 =
5.1667
0.6111
4.6667
-10.0000
b3 =
>> x6=B\b3
-1
0
2
-3
x6 =
6.6667
1.4444
4.6667
-16.0000
4. Factorice A=
[
A=
>> [L,U,P]=lu(A)
1
1
1
1
0
L=
1
3
3
4
2
1
5
6
1
3
1
3
1
2
4
1
7
1
3
5
1.0000
0
0
0
1.0000 1.0000
0
0
1.0000 0.6667 1.0000
0
0
0.6667 0.6000 1.0000
0
0
0
0
U=
1.0000 1.0000 1.0000 1.0000 1.0000
0
3.0000
0
1.0000 2.0000
0
0
5.0000 -0.6667 1.3333
0
0
0
3.7333 4.4667
0
0
0
0
3.5000
P=
>> [Q,U]=qr(A)
1
0
0
0
0
Q=
0
0
0
0
1
0.5000
0.5000
0.5000
0.5000
0
0
0
1
0
0
0
1
0
0
0
-0.5916
0.0845
0.0845
0.4226
0.6761
0
0
0
1
0
-0.1280
0.3231
0.5364
-0.7314
0.2377
0.4907
0.2590
-0.5588
-0.1908
0.5861
-0.3780
0.7559
-0.3780
0.0000
-0.3780
U=
2.0000 5.5000 6.5000 3.5000 6.0000
0
2.9580 2.7890 3.2961 4.7329
0
0
4.6874 0.8655 1.6640
0
0
0
2.6714 4.1026
0
0
0
0
2.6458
5. Haga operaciones elementales filas a la matriz A con tal de convertir toda la 1ra columna y
debajo del primer elemento de A en ceros.
>> A=[1 1 1 1 1;1 3 5 3 7;1 3 6 1 1;1 4 1 2 3;0 2 3 4 5]
A=
>> A(2,:)=A(2,:)-A(1,:)
1
1
1
1
0
A=
1
3
3
4
2
1
5
6
1
3
1
3
1
2
4
1
7
1
3
5
1
2
3
4
2
1
4
6
1
3
1
2
1
2
4
1
6
1
3
5
>> A(3,:)=A(3,:)-A(1,:)
1
0
1
1
0
A=
1
2
2
4
2
1
4
5
1
3
1
2
0
2
4
1
6
0
3
5
>> A(4,:)=A(4,:)-A(1,:)
1
0
0
1
0
A=
1
0
0
0
0
1
2
2
3
2
1
4
5
0
3
1
2
0
1
4
1
6
0
2
5
CAPITULO 4: POLINOMIOS
6. Evaluar los polinomios en x = 1:0.3:7
i.
ii.
P3=x10+ x+ 1
En Matlab:
i)
>> p2=[2,0,0,0,3i,6-2i];
>> x=1:0.3:7;
>>polyval(p2,x)
ans =
1.0e+004 *
Columns 1 through 2
0.0008 + 0.0001i 0.0013 + 0.0002i
Columns 3 through 4
0.0027 + 0.0003i 0.0056 + 0.0004i
Columns 5 through 6
0.0109 + 0.0005i 0.0201 + 0.0006i
Columns 7 through 8
0.0350 + 0.0006i 0.0579 + 0.0007i
Columns 9 through 10
0.0915 + 0.0008i 0.1393 + 0.0009i
Columns 11 through 12
0.2054 + 0.0010i 0.2946 + 0.0011i
Columns 13 through 14
0.4125 + 0.0012i 0.5656 + 0.0013i
Columns 15 through 16
0.7610 + 0.0014i 1.0072 + 0.0014i
Columns 17 through 18
1.3133 + 0.0015i 1.6898 + 0.0016i
Columns 19 through 20
2.1481 + 0.0017i 2.7009 + 0.0018i
Column 21
3.3620 + 0.0019i
ii)
>> p3=[1,0,0,0,0,0,0,0,0,1,1];
>> x=1:0.3:7;
>>polyval(p3,x)
ans =
1.0e+008 *
Columns 1 through 4
0.0000 0.0000 0.0000 0.0000
Columns 5 through 8
0.0000 0.0001 0.0003 0.0008
Columns 9 through 12
En Matlab:
>> p=[1 0 -i 2];
>> q=conv(p,p)
q=
Columns 1 through 4
1.0000
0 - 2.0000i 4.0000
Columns 5 through 7
-1.0000
0 - 4.0000i 4.0000
>> r=conv(q,p)
r=
Columns 1 through 4
1.0000
Columns 5 through 8
0 - 3.0000i 6.0000
-3.0000
Columns 9 through 10
0 -12.0000i 8.0000
>>conv(r,p)
ans =
Columns 1 through 4
1.0000
0 - 4.0000i 8.0000
Columns 5 through 8
-6.0000
Columns 9 through 12
1.0000 -48.0000i 32.0000 + 8.0000i -24.0000
0 -32.0000i
Column 13
16.0000
9. Hallar el resto de la divisin de p(x) por d(x)= x3 - ix+2, siendo p(x) el polinomio
Caracterstico de la matriz A.
11111
13537
A= 1 3 6 1 1
14123
02345
En Matlab:
>> A=[1,1,1,1,1;1,3,5,3,7;1,3,6,1,1;1,4,1,2,3;0,2,3,4,5]
A=
1
1
1
1
1
0
1
3
3
4
2
1
5
6
1
3
1
3
1
2
4
7
1
3
5
>>poly(A)
ans =
Columns 1 through 4
1.0000 -17.0000 47.0000 -4.0000
Columns 5 through 6
203.0000 -196.0000
>> P=poly(A);
>> [Q,R]=deconv(P,[1,0,-i,2])
Q=
Columns 1 through 2
1.0000
-17.0000
Column 3
47.0000 + 1.0000i
R=
1.0e+002 *
Columns 1 through 2
0
Columns 3 through 4
0
-0.0600 - 0.1700i
Columns 5 through 6
2.3600 + 0.4700i -2.9000 - 0.0200i
10. Hallar la derivada del cociente de la divisin de P(x)=x10+ x+ 1 por
D(x)= x3-i x+ 2
En Matlab:
>> p=[1,0,0,0,0,0,0,0,0,1,1];
>> d=[1,0,-i,2];
>> [Q,R]=deconv(p,d)
Q=
Columns 1 through 2
1.0000
Columns 3 through 4
0 + 1.0000i -2.0000
Columns 5 through 6
-1.0000
0 - 4.0000i
Columns 7 through 8
4.0000 - 1.0000i 6.0000
R=
Columns 1 through 2
0
Columns 3 through 4
0
Columns 5 through 6
0
Columns 7 through 8
0
Columns 9 through 10
1.0000 +12.0000i -7.0000 + 8.0000i
Column 11
-11.0000
>> D=polyder(Q)
D=
Columns 1 through 2
7.0000
Columns 3 through 4
0 + 5.0000i -8.0000
Columns 5 through 6
-3.0000
0 - 8.0000i
Column 7
4.0000 - 1.0000i
En Matlab:
>>fzero('x.*sin(x)+2',-6)
ans =
-5.9398
>>fzero('x.*sin(x)+2',-4)
ans =
-3.7108
>>fzero('x.*sin(x)+2',6)
ans =
5.9398
>>fzero('x.*sin(x)+2',4)
ans =
3.7108
Graficamos:
2. Grafique:
a)
b) | |
Para
a)
graficando:
| |
90
120
60
1.5
1
150
30
0.5
180
210
330
240
300
270
%B
theta=0:pi/20:2*pi;
r=5*theta;
polar(theta,r);
90
40
120
60
30
20
150
30
10
180
210
330
240
300
270
%C
theta=0:pi/20:2*pi;
r=2-sin(theta);
polar(theta,r);
90
120
60
2
150
30
1
180
210
330
240
300
270
%A
t=0:0.1:2*pi
x1=sin(t)
y1=sin(2*t)
%PRIMERA FIGURA
subplot(1,2,1)
plot(t,x1)
%SEGUNDA FIGURA
subplot(1,2,2)
plot(t,y1)
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
-0.2
-0.2
-0.4
-0.4
-0.6
-0.6
-0.8
-0.8
-1
-1
%B
t=0:0.1:2*pi
x1=sin(t)
y1=cos(t)
%PRIMERA FIGURA
subplot(1,2,1)
plot(t,x1)
%SEGUNDA FIGURA
subplot(1,2,2)
plot(t,y1)
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
-0.2
-0.2
-0.4
-0.4
-0.6
-0.6
-0.8
-0.8
-1
-1
Solucin:
function bloq=bloque(A,B);
%bloque(A,B) halla la matriz bloque diagonal (m+p)x(n+q)
%donde la matriz A es del orden (mxn) y B del orden (pxq)
bloq=blkdiag(A,B);
end
En la ventana de comandos:
>> A=[4 11 2;6 9 1;2 3 7]
A=
4 11 2
6 9 1
2 3 7
>> B=[5 9;2 5]
B=
5
2
9
5
>> bloque(A,B)
ans =
4 11 2 0 0
6 9 1 0 0
2
0
0
3
0
0
7
0
0
0
5
2
0
9
5
>>r = mmedad(17)
debe dar:
r=0
Solucin:
function r = mmedad(n);
%mmedad determina si la persona es mayor de edad
r=all(n>=18);
end
En la ventana de comandos:
>> r = mmedad(15)
;
r=
>> r = mmedad(22)
r=
1
3. Escribir una funcin (programa) para calcular el mayor y menor lado de un tringulo
sin usar la sentencia if.
Solucin:
function [ladomayor,ladomenor]= trian(a,b,c)
ladomayor=sort([a,b,c]);
ladomayor=ladomayor(1,3);
ladomenor=sort([a,b,c]);
ladomenor=ladomenor(1,1);
end
En la ventana de comandos:
>> [ladomayor,ladomenor]= trian(1,8,4)
ladomayor =
8
ladomenor =
Solucin:
function suma = polysum(p,q)
%polysum halla la suma de los polinomios p y q
suma=p+q;
end
En la ventana de comandos:
>> p=[1 5 6]
p=
1
>> q=[8 5 4]
q=
8
>> suma=polysum(p,q)
suma =
9 10 10