Documentos de Académico
Documentos de Profesional
Documentos de Cultura
2012
Trabajo Laboratorio
Mtodos Numricos
Directorio actual, rea en la cual es exhibida la lista de los archivos y directorios contenidos en el directorio
actual.
2.
>> dir
.
extern
license.txt
..
help
licenses
appdata
ja
bin
java
etc
lib
3.
resources
rtw
notebook
runtime
Solucionario
patents.txt
simulink
sys
toolbox
trademarks.txt
uninstall
4.
5.
6.
Duplicar los archivos de la carpeta COLOR que comiencen con m y tengan extensin m asignando
a los duplicados la letra inicial p y la extensin p.
7.
>> diag(A)
ans =
2
1
3
>> det(A)
ans =
8
>> rank(A)
ans =
3
>> inv(A)
ans =
0.1250
0.6250 -0.5000
-0.6250 -0.1250
1.5000
A=
2
>> B=diag(A)
B=
2
1
3
>> C=diag(fliplr(A))
C=
7
1
1
>> D=[B,C]
D=
-4
-2
-7
14
>> B=[3;0;2]
B=
3
0
2
>> X=A\B
X=
1.1967
0.8361
0.4754
-1
-1
-1
-1
-1
>> B=[4;1;-3;4]
B=
4
1
-3
4
>> X=A\B
X=
-1.0000
2.0000
-0.0000
1.0000
-1
-5
>> X=A\b2
X=
-0.2222
-0.5556
2.3333
2.3333
>> b3=[-1;0;2;-3]
b3 =
-1
0
2
-3
>> X=A\b3
X=
2.4444
-0.8889
0.3333
-1.6667
>> B=[-1 3 2 0.5;2 -6 -1 0;0 6 2 1;5 -3 0 2]
B=
-1.0000
3.0000
2.0000
0.5000
6.0000
2.0000
5.0000 -3.0000
1.0000
2.0000
>> X=B\b1
X=
0.8333
0.0556
1.3333
-2.0000
>> X=B\b2
X=
5.1667
0.6111
4.6667
-10.0000
>> X=B\b3
X=
6.6667
1.4444
4.6667
-16.0000
>> [L,U]=lu(A)
L=
1.0000
1.0000
0.6667
0.8000 0.5000
1.0000
1.0000
0.6667
1.0000
1.0000
1.0000
0.6667
0
0
0.6000
1.0000
U=
1.0000
1.0000
1.0000 1.0000
3.0000
1.0000
1.0000
2.0000
4.4667
0 3.5000
>> [L,U,P]=lu(A)
L=
1.0000
1.0000
1.0000
1.0000
0.6667
1.0000
0.6667
1.0000
0
0
0.6000
0
0
1.0000
0.6667
0.8000 0.5000
1.0000
1.0000
1.0000 1.0000
1.0000
U=
1.0000
3.0000
1.0000
2.0000
4.4667
0 3.5000
P=
1
>> [Q,R]=qr(A)
Q=
-0.5000
0.5916
0.1280
0.4907
0.3780
0.2590 -0.7559
0.3780
-0.5000 -0.4226
0.0000
0.7314 -0.1908
0 -0.6761 -0.2377
0.5861
0.3780
R=
-2.0000 -5.5000 -6.5000 -3.5000 -6.0000
0
2.6714
4.1026
0 -2.6458
>> Q*R
ans =
1.0000
1.0000
1.0000 1.0000
1.0000
1.0000
3.0000
5.0000 3.0000
7.0000
1.0000
3.0000
6.0000 1.0000
1.0000
1.0000
4.0000
1.0000 2.0000
3.0000
2.0000
3.0000
5.0000
10
4.0000
10
>> A
A=
1
>> A(3,:)=A(3,:)-A(1,:)
A=
1
>> A(4,:)=A(4,:)-A(1,:)
A=
1
11
11
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
12
12
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
0.0021
0.0048
0.0105 0.0216
Columns 13 through 16
0.0424
0.0798
0.1446 0.2533
Columns 17 through 20
0.4308
0.7133
1.1529 1.8228
Column 21
2.8248
13
13
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
0 - 3.0000i 6.0000
Columns 5 through 8
-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
14
14
A=
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
0
1
3
3
4
2
1
5
6
1
3
1
3
1
2
4
1
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
15
15
Columns 3 through 4
0
-0.0600 - 0.1700i
Columns 5 through 6
2.3600 + 0.4700i -2.9000 - 0.0200i
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
16
16
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
11. Hallar las races de la funcin f(x)= xsenx+2 cercanas a 6, 4, 4 y 6.
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
17
17
1. 0 7.5
2. 5 4.0
3. 2 5.0
3. 5 5.5
2. 0 6.3
7. 8 6.2
8. 1 6.0
9. 7 5.0
10. 3 3.0
2. Graficar usando este archivo la 1ra columna versus la 2da columna a travs
de una poligonal lineal, use textread para leer los datos de este archivo.
>> textread('PREGUNTA1MATLAB.txt')
ans =
1.0000
7.5000
2.5000
4.0000
3.2000
5.0000
3.5000
5.5000
2.0000
6.3000
7.8000
6.2000
8.1000
6.0000
9.7000
5.000
10.3000
3.0000
18
18
>> [col1,col2]=textread('PREGUNTA1MATLAB.txt')
col1 =
1.0000
2.5000
3.2000
3.5000
2.0000
7.8000
8.1000
9.7000
10.3000
col2 =
7.5000
4.0000
5.0000
5.5000
6.3000
6.2000
6.0000
5.0000
3.0000
>> plot(col1,col2)
19
19
3. Graficar :
a. x2-y2=3
>> x= 0:0.5:5;
>> y=sqrt((x.^2)-3);
>> plot(x,y)
b. [[x]]+ lyl = 10
>> x=0:0.5:5;
>> y=10-floor(x);
>>plot(x,y)
20
20
b) r2 5, 0:/ 20: 2
>> a=0:pi/20:2*pi;
>> polar(a,5*a)
21
21
c) r3 2sen(), 0: / 20: 2
>> a=0:pi/20:2*pi;
>> polar(a,2-sin(a))
5.
Use subplot para dividir la ventana en 1x2 para luego graficar en ellas las
siguientes curvas paramtricas (R R2).
SOLUCION:
>> subplot(1,2,1);
>> syms t, ezplot(sin(t),sin(2*t),[0,2 *pi]);
>> subplot(1,2,2);
>> syms t, ezplot(sin(t),cos(t),[0,2 *pi]);
22
22
23
23