Sunteți pe pagina 1din 11

PRCTICA 01

1) Crear un vector de vectores impares desde 131 hasta 153.


>> syms x1 x2 x3 x4
>> [x1, x2, x3]=solve('2*x1-x2=3', '-x1+2*x2-x3=-3', '-x2+2*x3=1')
x1 =
1
x2 =
-1
x3 =
0
>> [x1, x2, x3, x4]=solve('4*x1+x2+x3+x4=0.65', 'x1+3*x2x3+x4=0.05', 'x1-x2+2*x3=0', 'x1+x2+2*x4=0.5', 'x1,x2,x3,x4')
x1 =
0.2
x2 =
-0.2
x3 =
-0.2
x4 =
0.25
2) Hallar la inversa de las matrices de coeficientes del problema
N1 con las operaciones elementales.
>> A=[2 -1 0;-1 2 -1;0 -1 2]
A=
2 -1
0
-1
2 -1
0 -1
2
>> B=[4 1 1 1;1 3 -1 1;1 -1 2 0;1 1 0 2]
B=
4
1
1
1
1
3 -1
1
1 -1
2
0
1
1
0
2
>> I=[1 0
I=
1
0
0
1
0
0

0;0 1 0;0 0 1]
0
0
1

>> Ainv=I/A
Ainv =

0.7500
0.5000
0.2500

0.5000
1.0000
0.5000

0.2500
0.5000
0.7500

>> Binv=I/B
Binv =
0.4000 -0.2000 -0.3000 -0.1000
-0.2000 0.6000 0.4000 -0.2000
-0.3000 0.4000 0.8500 -0.0500
-0.1000 -0.2000 -0.0500 0.6500
3) Hallar la inversa de la matriz A y V con operaciones elementales
>> I=[1 0
I=
1
0
0
1
0
0

0;0 1 0;0 0 1]
0
0
1

>> A=[2 6 3;3 5 8; 1 4 9]


A=
2
6
3
3
5
8
1
4
9
>> Ainv=I/A
Ainv =
-0.1940 0.6269 -0.4925
0.2836 -0.2239 0.1045
-0.1045 0.0299 0.1194
>> V=[2 5 7;7 4 9;0 2 6]
V=
2
5
7
7
4
9
0
2
6
>> Vinv=I/V
Vinv =
-0.0600 0.1600 -0.1700
0.4200 -0.1200 -0.3100
-0.1400 0.0400 0.2700
4) Dado los polinomios:

a p ( x )=x 4+ 2 x 35 x +4 b r ( x )=x 5 +2/3 x 42 x 35 x+ 5/ 3


c q ( x ) =x 6+

( 13 ) i x 4 ix5 x +6 d h ( x ) =3 x +2 x 5 sen ( pi/4)x + 4


3

Evaluar en: x = 5, x = (3 -2 i 2i), x = A, x = V


>> syms x
>> px=x^4+2*x^3-5*x+4;

>> qx=x^6+(1/3)*i*x^4+4*i*x^3-5*x+6;
>> rx=x^5+(2/3)*x^4-2*x^3-5*x+(5/3);
>> hx=-3*x^4+2*x^3-5*sin(pi/4)*x+4;
>> p=sym2poly(px);
>> q=sym2poly(qx);
>> r=sym2poly(rx);
>> h=sym2poly(hx);
>> x1=5;x2=[3 -2 i 2*i 6];
>> x3=[2 6 3 ;3 5 8; 1 4 9];x4=[2 5 7; 7 4 9; 0 2 6];
>> polyval(p,x1)
ans =
854
>> polyval(p,x2)
ans =
1.0e+003 *
0.1240
0.0140
1.7020
>> polyval(p,x3)
ans =
26
1702
124
854
2
368
>> polyval(p,x4)
ans =
26
854
3056
368
4
26

0.0050 - 0.0070i

0.0200 - 0.0260i

124
5084
7978

3056
7978
1702

>> polyval(q,x1)
ans =
1.5606e+004 + 7.0833e+002i
>> polyval(q,x1)
ans =
1.5606e+004 +7.0833e+002i
>> polyval(q,x2)
ans =
1.0e+004 *
0.0720 + 0.0135i 0.0080 - 0.0027i 0.0009 - 0.0005i -0.0026 0.0005i 4.6632 + 0.1296i
>> polyval(q,x3)
ans =
1.0e+005 *
0.0006 + 0.0004i
0.0072 + 0.0014i
0.0000 + 0.0000i
>> polyval(q,x4)
ans =

0.4663 + 0.0130i
0.1561 + 0.0071i
0.0408 + 0.0034i

0.0072 + 0.0014i
2.6211 + 0.0341i
5.3140 + 0.0510i

1.0e+005 *
0.0006 + 0.0004i
1.1762 + 0.0217i
0.0001

0.1561 + 0.0071i
0.0408 + 0.0034i
0.0006 + 0.0004i

1.1762 + 0.0217i
5.3140 + 0.0510i
0.4663 + 0.0130i

>> polyval(r,x1)
ans =
3.2683e+003
>> polyval(r,x2)
ans =
1.0e+003 *
0.2297
0.0063
8.1797
>> polyval(r,x3)
ans =
1.0e+004 *
0.0018 0.8180
0.0230 0.3268
-0.0004 0.1048

0.0230
3.4436
6.1922

>> polyval(r,x4)
ans =
1.0e+004 *
0.0018 0.3268
1.7688 0.1048
0.0002 0.0018

1.7688
6.1922
0.8180

0.0023 - 0.0020i

0.0123 + 0.0380i

0.0010 - 0.0055i

-0.0440 - 0.0231i

>> polyval(h,x1)
ans =
-1.6387e+003
>> polyval(h,x2)
ans =
1.0e+003 *
-0.1956
-0.0529
-3.4732
>> polyval(h,x3)
ans =
1.0e+004 *
-0.0035 -0.3473 -0.0196
-0.0196 -0.1639 -1.1288
-0.0001 -0.0650 -1.8253
>> polyval(h,x4)
ans =
1.0e+004 *
-0.0035 -0.1639 -0.6538
-0.6538 -0.0650 -1.8253
0.0004 -0.0035 -0.3473
5) Multiplique los polinomios p(x) y q(x);

h(x) y r(x);

p(x) y h(x)

>> pq=conv(p,q)
pq =
Columns 1 through 5
1
2
4.6667i
4+
8i
Columns 6 through 10
-5 - 1.6667i
-4 -50
Column 11
24
>> hr=conv(h,r)
hr =
-3
0
-4.6667
17.678
>> ph=conv(p,h)
ph =
-3
-4
17.678
-34.142

0 + 0.33333i
18.667i

12 +

16i

7.3333
-7.5355
16.643
-25.893
6.6667

4
16

11.464

-5 +

-25.071

25

-5.2623

16

6) Halle el cociente y el residuo de: q(x)/p(x); r(x)/h(x); q(x)/r(x);


p(x)/h(x)
>> [Q,R]=deconv(q,p)
Q=
1
R=
Columns 1 through 5
0
+
3.3333i
-14
Columns 6 through 7
23 +
1.6667i
>> [Q,R]=deconv(r,h)
Q=
-0.33333
-0.44444
R=
0
0
3.4444

-2

4+

-10 -

>> [Q,R]=deconv(p,h)
Q=
-0.33333

-3

1.3333i

-1.1111

>> [Q,R]=deconv(q,r)
Q=
1
-0.66667
R=
Columns 1 through 5
0
0
+
4i
5
Columns 6 through 7
-10
7.1111

0.33333i

-1.1785

2.4444 + 0.33333i

-5.238

-1.3333

R=
0

2.6667

-6.1785

5.3333

7) Halle la derivada de los polinomios p(x), q(x),


>> dp=polyder(p)
dp =
4
6
>> polyder(q)
dq =
6
0
-5

>> polyder(r)
dr =
5
2.6667
-5
>> polyder(h)
dh =
-12

h(x)

-5

+ 1.3333i

0 +

-6

r(x)

12i

-3.5355

8) Halle la derivada de: q(x)/p(x); r(x)/h(x); q(x)/r(x);

p(x)/h(x)

N representa los coeficientes del numerador de la derivada de f(x)/g(x)


D representa los coeficientes del denominador de la derivada de
f(x)/g(x)
>> [N,D]=polyder(q,p)
N=
Columns 1 through 5
2
6
- 3.3333i
24
Columns 6 through 10
15 - 5i
-4 - 34.667i
10
D=
1
4
4
-10
-12
16
>> [N,D]=polyder(r,h)
N=
-3
4
-4.6667
-34
0
-14.107
D=
9
-12
4
-28.284
16
>> [N,D]=polyder(q,r)
N=
Columns 1 through 5
1
1.3333
-25 - 3.3333i

-14.142
21.213

-6 -

-25

-36 + 48i
16

-32.071
-38.142

0.33333i

25

-40

64.809
16

12.5

- 8i

Columns 6 through 10
30
-20 - 5i
-36 - 37.778i
0
Column 11
21.667
D=
1
1.3333
-3.5556
-2.6667
-6
22.222
-6.6667
25
-16.667
2.7778

>> [N,D]=polyder(p,h)
N=
8
0
-55.607
-5.8579
D=
9
-12
4
-28.284
16

69.858
21.213

36

20i

-3.3333

-38.142

16

12.5

9) Averige qu significa polyvalm () y aplique a las matrices A y V


de N3.
POLYVALM - matriz de evaluacin polinomio
Sintaxis
Y = polyvalm (p, A)
Descripcin
Y = polyvalm (p, A). La orden polivalm nos permite evaluar una matriz
(X) polinomialmente (p)
si p(x) = cnxn + cn1xn1 + + c1x + c0, es el polinomio p y A es un
matriz cualquiera, entonces , p(A) =cnAn + cn1An1 + + c1A + c0
puede obtenerse con la funcin polyvalm(p,A).
10)

Halla la integral de los polinomios p(x),

>> ip=polyint(p)
ip =
0.2000
0.5000
>> iq=polyint(q)
iq =
Columns 1 through 7
0.1429
0
-2.5000
6.0000
Column 8
0
>> ir=polyint(r)
ir =
0.1667
0.1333
1.6667
0
>> ih=polyint(h)
ih=

q(x),

r(x)

h(x)

0 -2.5000

4.0000

0 + 0.0667i

0 + 1.0000i

-2.5000

-0.5000

-0.6000

0.5000

-1.7678

4.0000

0
>> pretty(poly2sym(ip))
5
4
2
x
x 5 *x
-- + -- - ---- + 4 x
5
2
2

>> pretty(poly2sym(ir))
6
5 4
2
x 2* x x 5 x 5 x
-- + ---- - -- - ---- + --6
15
2
2
3

>> pretty(poly2sym(iq))
7 5
2
x
x i
4
5x
-- + ---- + x i - ---- + 6 x
7
15
2

>> pretty(poly2sym(ih))
5
4

2
3* x x 5* 2 * x
- ---- + -- - --------- + 4 x
5
2
4

11) Dado las matrices V y X, explique qu significa polyint(V),


polyintm(X)
stas funciones no se pueden aplicar a una matrix
>>V=[1 2 3;4 5 6;2 1 8];
>> X=[2 1 9;3 2 7;1 8 5]
X=
2
1
9
3
2
7
1
8
5
>> polyintm(X)
??? Undefined function or method 'polyintm' for input arguments of
type 'double'.
12) Si r es un vector, entonces que operacin realiza el comando
poly(r) y si A es una matriz, entonces realiza el comando poly(A)
Si r es un vector poly cumple la funcin inversa de roots. Encuentra los
coeficientes del polinomio cuyas races son los elementos de r.
>> r=[6 4 3 5]
r=
6
4
3
5
>> poly(r)
ans =
1 -18 119 -342 360
Si A es una matriz poly muestra los coeficientes de su polinomio
caracterstico.
>> A=[2 6 4 ;3 4 6;7 8 9]
A=
2
6
4
3
4
6
7
8
9
>> poly(A)
ans =
-15.0000 -32.0000 -50.0000
13)

Halle las races de los polinomios p(x),

q(x),

r(x)

h(x)

>> roots(p)
ans =
-1.7996 + 1.3070i
-1.7996 - 1.3070i
0.7996 + 0.4115i
0.7996 - 0.4115i
>> roots(q)
ans =
-1.5446 - 0.9326i
0.0936 + 1.7493i
-1.0459 + 0.7330i
1.4541 - 0.7471i
0.2753 - 1.0797i
0.7675 + 0.2771i
>> roots(r)
ans =
-2.1623
1.5855
-0.2060 + 1.2111i
-0.2060 - 1.2111i
0.3221
>> roots(h)
ans =
-1.1400
0.4336 + 1.0281i
0.4336 - 1.0281i
0.9395
14) Halle los autovalores y auto vectores de las matrices V y X de
N 12
>> V = [1 2 3;4 5 6;2 1 8];X=[2 1 9;3 2 7;1 8 5];
>> [AX,AV] = eig(A,X)
% AX Matriz con los autovectores de A y B
AX =
-0.1174
0.8849 + 0.1151i
0.8849 - 0.1151i
1.0000
-0.0831 - 0.3774i
-0.0831 + 0.3774i
0.7232
-0.4321 + 0.1287i
-0.4321 - 0.1287i
% AV Matriz con los autovalores de A y B
AV =
1.1903
0
0
0
-0.0900 + 0.6485i
0
0
0
-0.0900 - 0.6485i
15)

Hallar las normas ||V||1 , ||V||2, ||V||

v2.

de los vectores v1 y

v 1=( 7, 3,2, 1,5, 8, 9 ) , v 2=(sen ( k ) , cos ( k ) ,3 k )


ans =
35

>> v1=[7 3 -2 1 5 8 9];


>> norm(v1,1)

>> norm(v1,2)
ans =

15.2643
>> norm(v1,inf)
ans =
9
% K=
>> v2=[sin(pi) cos(pi) 3^pi];
>> norm(v2,1)

ans =
32.5443
>> norm(v2,2)
ans =
31.5601
>> norm(v2,inf)
ans =
31.5443

16) Dado al matriz M, halle su polinomio caracterstico, sus


autovalores y sus autovectores respectivos, su radio espectral
>> M=[1 0 2;0 1 -1;-1 1 1];
>> poly(M)
ans =
1.0000 -3.0000 6.0000 -4.0000
>> [AX,AV]=eig(M)
% Autovectores
AX =
-0.7071
-0.7071
0.7071
0.3536 + 0.0000i 0.3536 - 0.0000i 0.7071
-0.0000 - 0.6124i -0.0000 + 0.6124i 0.0000
% Autovectores
AV =
1.0000 + 1.7321i
0
0
0
1.0000 - 1.7321i
0
0
0
1.0000
>> RE=norm(AV,1)
RE =
2.0000
17)

Hallar las normas ||M||1 , ||M||2, ||M||, ||M||F de la matriz M

>> norm(M,1) % ||M||1


ans =
4
>> norm(M,2) % ||M||2
ans =
2.4998
>> norm(M,inf)
ans =
3

% ||M||

>> norm(M,'fro')
ans =
3.1623

% ||M||F

18) Para qu sirven los comandos mldivide(), Rank() aplique a


ejemplos?

mldivide(A,B).- Es equivalente a expresar A\B o INV(A)*B

Rank(A).- Nos muestra el nmero de valores singulares de la matriz


de A

S-ar putea să vă placă și