Vous êtes sur la page 1sur 8

CAPITULO 02

>> % 2.11 PROBLEMAS.


>> % 1
>> Q=[ 32 4 81 exp(2.5) cos(pi/3) 14 12]
Q =
Columns 1 through 5
32.0000

4.0000

81.0000

12.1825

0.5000

14.0000

12.0000

>> % 2
>> S=[55 14 log(51) 987 5*sin(2.5*pi)]'
ans =
55.0000
14.0000
3.9318
987.0000
5.0000
>> % 3
>> x=[1:2:33]
x =
Columns 1 through 8
1
27

3
29

5
31

Column 17
33
>> % 4)
>> W=[15:-5:-25]'
ans =
15
10
5
0
-5
-10
-15
-20
-25
>> % 5)
>> R=linspace(7,15,40)

11

13

15

17

19

21

23

25

R =
Columns 1 through 5
7.0000
8.6410

7.2051
8.8462

7.4103

7.6154

7.8205

8.0256

8.2308

8.435

9.0513
9.2564
9.4615
10.6923 10.8974

9.6667

9.8718

10.0769

10.2821

10.48

11.7179

11.9231

12.1282

12.3333

12.53

13.7692

13.9744

14.1795

14.3846

14.58

Columns 11 through 15
72

Columns 21 through 25
11.1026 11.3077 11.5128
12.7436 12.9487

85

Columns 31 through 35
13.1538 13.3590 13.5641
14.7949 15.0000

97

>> % 6)
>> R=linspace(-1,-15,12)'
R =
-1.0000
-2.2727
-3.5455
-4.8182
-6.0909
-7.3636
-8.6364
-9.9091
-11.1818
-12.4545
-13.7273
-15.0000
>> % 7
>> Aprimero=(4:3:49)
Aprimero =
Columns 1 through 8
4

10

13

16

19

22

25

40

43

46

49

Columns 9 through 16
28

31

34

37

>> Asegundo=(4:3:13),(13:3:49)
Asegundo =

10

13

ans =
Columns 1 through 8
13

16

19

22

25

28

31

34

Columns 9 through 13
37

40

43

46

49

>> % 8)
>> B=[1:3:25; 72:-6:24; 0:0.125:1]
B =
Columns 1 through 5
1.0000
72.0000
0

4.0000
66.0000
0.1250

7.0000
60.0000
0.2500

10.0000
54.0000
0.3750

22.0000
30.0000
0.8750

25.0000
24.0000
1.0000

13.0000
48.0000
0.5000

Columns 6 through 9
16.0000
42.0000
0.6250

19.0000
36.0000
0.7500

>> % 9
>> A=[6 43 2 11 87; 12 6 34 0 5; 34 18 7 41 9]
A =
6
12
34

43
6
18

2
34
7

11
0
41

87
5
9

34

>> % 9 a)
>> va=A(2,:)
va =
12

>> % 9 b)
>> vb=A(:,4)'
vb =
11
0
41
>> vb2=[A(:,4)',(3:5)]

vb2 =
11

41

11

87

12

>> % 9 c)
>> vc=[A(1,:) A(2,:)]
vc =
Columns 1 through 8
6

43

>> % 9 d)
>> vd=[A(:,2)',A(:,5)']
vd =
43

18

87

>> % 10
>> C=[[2:2:10]; [3:3:15]; [7:7:35]]
C =
2
3
7

4
6
14

6
9
21

8
12
28

10
15
35

>> % 10 a)
>> ua=C(:,3)
ua =
6
9
21
>> % 10 b)
>> ub=C(2,:)'
ub =
3
6
9
12
15
>> % 10 c)
>> uc=[C(:,1)',C(:,3)',C(:,5)']'
uc =
2

34

3
7
6
9
21
10
15
35
>> % 10 d)
>> ud=[C(1,:),C(2,:)]'
ud =
2
4
6
8
10
3
6
9
12
15
>> % 11
>> D=[(1:7); (2:2:14); (21:-3:3); (5:5:35)]
D =
1
2
21
5

2
4
18
10

3
6
15
15

4
8
12
20

5
10
9
25

6
12
6
30

7
14
3
35

>> % 11 a)
>> D1=D([1 3 4],[1 3 5 7])
D1 =
1
21
5

3
15
15

5
9
25

7
3
35

% 11 b)
>> u=[D(3,:) D(:,5)' D(:,6)' D(:,7)']
u =
Columns 1 through 8
21
6

18
30

15

12

Columns 17 through 19
14

35

10

25

12

>> % 12
>> % 12 a)
>> zeros(2,5)
ans =
0
0

0
0

0
0

0
0

0
0
1
0

0
0
0
1

0
0
1
0
0
0
0

0
0
0
1
0
0
0

0
0

>> % 12 b)
>> eye(4,4)
ans =
1
0
0
0

0
1
0
0

>> % 12 c)
>> ones(3,2)
ans =
1
1
1

1
1
1

>> % 13
>> AA=eye(7,7)
AA =
1
0
0
0
0
0
0

0
1
0
0
0
0
0

0
0
0
0
1
0
0

0
0
0
0
0
1
0

0
0
0
0
0
0
1

>> AA(1:2,1:3)=2;AA(1:3,5:7)=5;AA(3,1:3)=3;AA(5:7,1:2)=4;AA(5:7,5:7)=9;AA(5:7,3)
=7
AA =
2
2
3
0
4
4
4

2
2
3
0
4
4
4

2
2
3
0
7
7
7

0
0
0
1
0
0
0

5
5
5
0
9
9
9

5
5
5
0
9
9
9

5
5
5
0
9
9
9

>> % 14
>> Z=zeros(3,5)
Z =
0
0
0

0
0
0

0
0
0

0
0
0

0
0
0

>> Z(1:3,3:4)=ones(3,2)
Z =
0
0
0

0
0
0

1
1
1

1
1
1

0
0
0

>> % 15
>> M=[(1:7);(8:14);(15:21);(22:28);(29:35)]
M =
1
8
15
22
29

2
9
16
23
30

3
10
17
24
31

4
11
18
25
32

>> M2=M([2:4],[3:6])
M2 =
10
17
24

11
18
25

12
19
26

>> % 16
>> A1=ones(3,3)
A1 =
1
1
1
1
1
1
1
1
1
>> B1=5*ones(2,2)
B1 =
5
5
5
5
>> A1(4:5,:)=[0]
A1 =
1
1
1
0

1
1
1
0

1
1
1
0

13
20
27

5
12
19
26
33

6
13
20
27
34

7
14
21
28
35

>> A1(:,(4:5))=[0]
A1 =
1
1
1
0
0

1
1
1
0
0

1
1
1
0
0

0
0
0
0
0

0
0
0
0
0

>> A1([4:5],[4:5])=[B1]
A1 =
1
1
1
0
0

1
1
1
0
0

1
1
1
0
0

0
0
0
5
5

0
0
0
5
5