Вы находитесь на странице: 1из 19

Prctica 1 Matlab

Ejercicio 1:
x=(10 -sqrt(6))/(12.8 + 19)
x=
0.2374
y=(sqrt(0.25 - 10^2))/15 + (47^(1/3))
y=
3.6088 + 0.6658i
Ejercicio 2:
>>help elfun
Elementary math functions.
v=-10:1:10
v=
Columns 1 through 15
-10

-9

-8

-7

-6

-5

-4

-3

-2

-1

Columns 16 through 21
5

10

t=sin(v)
t=
Columns 1 through 9
0.5440 -0.4121 -0.9894 -0.6570
-0.9093

0.2794

0.9589

0.7568 -0.1411

Columns 10 through 18
-0.8415
0.6570

0.8415

0.9093

Columns 19 through 21
0.9894

0.4121 -0.5440

plot(v,t),grid

0.1411 -0.7568 -0.9589 -0.2794

y=pow2(v)
y=
1.0e+03 *
Columns 1 through 9
0.0000
0.0003

0.0000

0.0000

0.0000

0.0000

0.0000

0.0001

0.0001

0.0040

0.0080

0.0160

0.0320

0.0640

Columns 10 through 18
0.0005
0.1280

0.0010

0.0020

Columns 19 through 21
0.2560

0.5120

1.0240

k=cosh(v)
k=
1.0e+04 *
Columns 1 through 9

1.1013
0.0004

0.4052

0.1490

0.0548

0.0202

0.0074

0.0027

0.0010

0.0004

0.0010

0.0027

0.0074

0.0202

6.7997 -0.8714

0.2910

3.3805 -1.1578

0.1425

Columns 10 through 18
0.0002
0.0548

0.0001

0.0002

Columns 19 through 21
0.1490

0.4052

1.1013

z=tan(v)
z=
Columns 1 through 9
-0.6484
2.1850

0.4523

Columns 10 through 18
-1.5574
0.8714

1.5574 -2.1850 -0.1425

1.1578 -3.3805 -0.2910

Columns 19 through 21
-6.7997 -0.4523

0.6484

Ejercicio 3:
x=-10:1:10
x=
Columns 1 through 15
-10

-9

-8

-7

-6

-5

-4

-3

-2

-1

Columns 16 through 21
5

10

y=x.^(2)
y=
Columns 1 through 15
100

81

64

49

36

25

Columns 16 through 21
25

36

49

64

81 100

16

16

plot(x,y),grid

x=-10:0.01:0.01
x=
Columns 1 through 4
-10.0000 -9.9900 -9.9800 -9.9700
..... Hasta el final...
y=x.^(-1)
y=
Columns 1 through 4
-0.1000 -0.1001 -0.1002 -0.1003
....Hasta el final.....
v=0.01:0.01:10
v=
Columns 1 through 4
0.0100

0.0200

0.0300

0.0400

....
Columns 997 through 1000
9.9700

9.9800

9.9900 10.0000

w=v.^(-1)
w=
Columns 1 through 4
100.0000 50.0000 33.3333 25.0000
....
Columns 997 through 1000
0.1003

0.1002

plot(x,y),grid
hold on
plot(v,w),grid

0.1001

0.1000

Ejercicio 4:
A=[1 -3 0;10 4 -5;3 -2 8]
A =

a)

1
10
3

-3
4
-2

0
-5
8

0
1
0

0
0
1

-3
5
-2

0
-5
9

C=eye(3)
C =
1
0
0
B= A + C
B =
2
10
3

b)
x=(A(1,:))*(A(:,3))
x =
15

c)
A(3,:)= A(3,:) + 3*A(1,:)
A =
1
10
6

-3
4
-11

0
-5
8

d)
A(:,1)=A(:,3)
A =
0
-5
8

e)

-3
4
-11

0
-5
8

D(:,1)=A(:,1)
D =
0
-5
8
D(:,2)=A(:,3)
D =
0
-5
8

0
-5
8

Ejercicio 5:
A=[1 -1 0;2 15 7;3 -2 1]
A=
1

-1

15

-2

a)
det(A)
ans =
10.0000
rank(A)
ans =
3
b)
min(A(1,:))
ans =
-1
min(A(2,:))
ans =
2
min(A(3,:))

ans =
-2
c)
-sort(-A(1,:))
ans =
1

-1

-sort(-A(2,:))
ans =
15

-sort(-A(3,:))
ans =
3

-2

-2

-1

15

d)
sort(A)
ans =

e)
inv(A)
ans =
2.9000

0.1000 -0.7000

1.9000

0.1000 -0.7000

-4.9000 -0.1000

A.'
ans =
1

1.7000

-1

15

-2

f)
max(max(abs(A)))
ans =
15

Ejercicio 7:
A=magic(5)
A=
17

24

15

23
4

5
6

14

16

13

20

22

10

12

19

21

11

18

25

3
9

a)
B=[A(2,:);A(4,:)]
B=
23

10

12

7
19

14
21

16
3

b)
C=[A(1,1:2:5);A(2,1:2:5);A(3,1:2:5);A(4,1:2:5);A(5,1:2:5)]
C=
17

15

23

16

13

22

4
10

19

11

25

c)
D=(A(:,3))
D=
1
7
13
19
25
d)
A(3,:)=[]
A=

17

24

23

10

12

19

21

11

18

25

15

14

16
3
9

Ejercicio 8:
t=(0:pi/24:2*pi)
t=
Columns 1 through 4
0

0.1309

0.2618

0.3927

Columns 5 through 8
0.5236

0.6545

0.7854

0.9163

Columns 9 through 12
1.0472

1.1781

1.3090

1.4399

Columns 13 through 16
1.5708

1.7017

1.8326

1.9635

Columns 17 through 20
2.0944

2.2253

2.3562

2.4871

Columns 21 through 24
2.6180

2.7489

2.8798

3.0107

Columns 25 through 28
3.1416

3.2725

3.4034

3.5343

Columns 29 through 32
3.6652

3.7961

3.9270

4.0579

Columns 33 through 36
4.1888

4.3197

4.4506

4.5815

Columns 37 through 40
4.7124

4.8433

4.9742

Columns 41 through 44

5.1051

5.2360

5.3669

5.4978

5.6287

Columns 45 through 48
5.7596

5.8905

6.0214

6.1523

Column 49
6.2832
a)
A=[t;sin(t);cos(t)]
A=
Columns 1 through 4
0

0.1309

0.2618

0.3927

0.1305

0.2588

0.3827

1.0000

0.9914

0.9659

0.9239

Columns 5 through 8
0.5236

0.6545

0.7854

0.9163

0.5000

0.6088

0.7071

0.7934

0.8660

0.7934

0.7071

0.6088

Columns 9 through 12
1.0472

1.1781

1.3090

1.4399

0.8660

0.9239

0.9659

0.9914

0.5000

0.3827

0.2588

0.1305

Columns 13 through 16
1.5708

1.7017

1.8326

1.9635

1.0000

0.9914

0.9659

0.9239

0.0000 -0.1305 -0.2588 -0.3827


Columns 17 through 20
2.0944

2.2253

2.3562

2.4871

0.8660

0.7934

0.7071

0.6088

-0.5000 -0.6088 -0.7071 -0.7934

Columns 21 through 24
2.6180

2.7489

2.8798

3.0107

0.5000

0.3827

0.2588

0.1305

-0.8660 -0.9239 -0.9659 -0.9914


Columns 25 through 28
3.1416

3.2725

3.4034

3.5343

0.0000 -0.1305 -0.2588 -0.3827


-1.0000 -0.9914 -0.9659 -0.9239
Columns 29 through 32
3.6652

3.7961

3.9270

4.0579

-0.5000 -0.6088 -0.7071 -0.7934


-0.8660 -0.7934 -0.7071 -0.6088
Columns 33 through 36
4.1888

4.3197

4.4506

4.5815

-0.8660 -0.9239 -0.9659 -0.9914


-0.5000 -0.3827 -0.2588 -0.1305
Columns 37 through 40
4.7124

4.8433

4.9742

5.1051

-1.0000 -0.9914 -0.9659 -0.9239


-0.0000

0.1305

0.2588

0.3827

Columns 41 through 44
5.2360

5.3669

5.4978

5.6287

-0.8660 -0.7934 -0.7071 -0.6088


0.5000

0.6088

0.7071

0.7934

Columns 45 through 48
5.7596

5.8905

6.0214

6.1523

-0.5000 -0.3827 -0.2588 -0.1305


0.8660

0.9239

0.9659

0.9914

Column 49
6.2832
-0.0000
1.0000
b)
size(A)
ans =
3

49

c)
plot(t,sin(t)),grid
hold on
plot(t,cos(t),'r')

Ejercicio 9:
x=linspace(1,10)
x=

Columns 1 through 4
1.0000

1.0909

1.1818

1.2727

...
Columns 97 through 100
9.7273

9.8182

9.9091 10.0000

A(:,1)=x
A=
1.0000
1.0909

10.0000
A(:,2)=x.^2
A=
1.0000

1.0000

1.0909

1.1901

10.0000 100.0000

A(:,3)=x.^(-1)

A=

1.0000

1.0000

1.0000

1.0909

1.1901

0.9167

1.1818

1.3967

0.8462

9.9091 98.1901

0.1009

10.0000 100.0000

0.1000

plot(x,'--rs','LineWidth',2,'MarkerEdgeColor','k', 'MarkerFaceColor','g',
'MarkerSize',4),grid
hold on
plot(x.^2,'--rs','LineWidth',2,'MarkerEdgeColor','k', 'MarkerFaceColor','r',
'MarkerSize',4)
plot(x.^(-1),'--rs','LineWidth',2,'MarkerEdgeColor','k', 'MarkerFaceColor','b',
'MarkerSize',4)

Ejercicio 10:
a)
A=[1 2 -3;0 2 -3;0 1 1]
A=
1

-3

-3

b=[4 -2 0]'

b=
4
-2
0

rank(A)
ans =
3
% Rango de la matriz formada por los coeficientes del sistema de
ecuaciones.
B=[A,b]
B=
1

-3

-3

-2

rank(B)
ans =
3
% Rango de la matriz ampliada del sistema de ecuaciones. Sendas matrices
poseen el mismo rango, que adems coincide con el nmero de incgnitas,
por ende el sistema de ecuaciones lineales es un sistema compatible
determinado , es decir, posee una solucin y adems es nica.
b)
x=A\b
x=
6.0000=x1
-0.4000=x2
0.4000=x3
%Soluciones del sistema de ecuaciones lineales.
Ejercicio 11:

a)
P=[2 3 5]
P=
2

r=roots(P)
r=
-0.7500 + 1.3919i
-0.7500 - 1.3919i
i=-15:1:15
i=
Columns 1 through 6
-15 -14 -13 -12 -11 -10
Columns 7 through 12
-9

-8

-7

-6

-5

-4

Columns 13 through 18
-3

-2

-1

Columns 19 through 24
3

Columns 25 through 30
9

10

11

12

13

14

Column 31
15
y=polyval(P,i)
y=
Columns 1 through 6
410 355 304 257 214 175
Columns 7 through 12
140 109

82

59

40

25

Columns 13 through 18
14

10

19

Columns 19 through 24
32

49

70

95 124 157

Columns 25 through 30
194 235 280 329 382 439
Column 31
500
b)
plot(i,y),grid

Вам также может понравиться