Vous êtes sur la page 1sur 8

Parte 1

a) v= [1:1:10]

v=

1 2 3 4 5 6 7 8 9 10

b) w= [10:-1:1]

w=

10 9 8 7 6 5 4 3 2 1

c) diag(v)

ans =

1 0 0 0 0 0 0 0 0 0

0 2 0 0 0 0 0 0 0 0

0 0 3 0 0 0 0 0 0 0

0 0 0 4 0 0 0 0 0 0

0 0 0 0 5 0 0 0 0 0

0 0 0 0 0 6 0 0 0 0

0 0 0 0 0 0 7 0 0 0

0 0 0 0 0 0 0 8 0 0

0 0 0 0 0 0 0 0 9 0

0 0 0 0 0 0 0 0 0 10

d) toeplitz(v)

ans =

1 2 3 4 5 6 7 8 9 10

2 1 2 3 4 5 6 7 8 9

3 2 1 2 3 4 5 6 7 8

4 3 2 1 2 3 4 5 6 7

5 4 3 2 1 2 3 4 5 6

6 5 4 3 2 1 2 3 4 5

7 6 5 4 3 2 1 2 3 4

8 7 6 5 4 3 2 1 2 3

9 8 7 6 5 4 3 2 1 2

10 9 8 7 6 5 4 3 2 1

José Guillermo Valeriano Leaño


e) toeplitz(w)

ans =

10 9 8 7 6 5 4 3 2 1

9 10 9 8 7 6 5 4 3 2

8 9 10 9 8 7 6 5 4 3

7 8 9 10 9 8 7 6 5 4

6 7 8 9 10 9 8 7 6 5

5 6 7 8 9 10 9 8 7 6

4 5 6 7 8 9 10 9 8 7

3 4 5 6 7 8 9 10 9 8

2 3 4 5 6 7 8 9 10 9

1 2 3 4 5 6 7 8 9 10

f) ones(10)

ans =

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1

g) zeros(10)

ans =

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

José Guillermo Valeriano Leaño


0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

h) eye(10)

ans =

1 0 0 0 0 0 0 0 0 0

0 1 0 0 0 0 0 0 0 0

0 0 1 0 0 0 0 0 0 0

0 0 0 1 0 0 0 0 0 0

0 0 0 0 1 0 0 0 0 0

0 0 0 0 0 1 0 0 0 0

0 0 0 0 0 0 1 0 0 0

0 0 0 0 0 0 0 1 0 0

0 0 0 0 0 0 0 0 1 0

0 0 0 0 0 0 0 0 0 1

i) y= [52+(71-52)*rand(3)]

y=

67.4798 69.3541 57.2915

69.2100 64.0148 62.3907

54.4127 53.8533 70.1926

j) size(y)

ans =

2 3

Parte 2

José Guillermo Valeriano Leaño


a) v=linspace(0,150,8);

u=[v;v;v;v;v;v;v;v]

b) u=linspace(10,100,64);

a=u(:,1:8);

b=u(:,9:16);

c=u(:,17:24);

d=u(:,25:32);

e=u(:,33:40);

f=u(:,41:48);

g=u(:,49:56);

h=u(:,57:64);

y=[a;b;c;d;e;f;g;h]

c) q=round(y);

w=fix(y);

q=w

10 11 12 14 15 17 18 20

21 22 24 25 27 28 30 31

32 34 35 37 38 40 41 42

44 45 47 48 50 51 52 54

55 57 58 60 61 62 64 65

67 68 70 71 72 74 75 77

78 80 81 82 84 85 87 88

90 91 92 94 95 97 98 100

Parte 3
a) w=20*rand(5)

18.3439 11.3564 18.6802 6.7425 3.3130

5.7168 1.5171 2.5981 3.2436 12.0396

15.1440 1.0790 11.3765 15.8857 5.2594

15.0746 10.6160 9.3878 6.2243 13.0816

José Guillermo Valeriano Leaño


7.6089 15.5833 0.2380 10.5707 13.7843

b) q = 20*rand(6) + 5

q=

19.9630 21.5163 24.2380 12.9957 10.2761 7.8991

14.0108 15.7668 5.0927 10.1974 7.9108 22.0606

6.6764 24.9227 20.4982 21.0014 7.7214 17.4411

9.5795 6.5635 21.3461 13.6283 22.3858 12.0190

23.2667 13.8536 22.3739 23.2130 16.5941 15.2650

8.0476 7.1331 6.6887 8.6369 15.9972 13.0362

c) round(w)

round(q)

Parte 4
a)

a=[1,2,3,4;5,6,7,8;9,1,5,6];

b=zeros(3,2);

c=cat(2,a,b)

d=zeros(2,6)

e=cat(1,c,d)

e=

1 2 3 4 0 0

5 6 7 8 0 0

9 1 5 6 0 0

0 0 0 0 0 0

0 0 0 0 0 0

b)

a=rand(3,4)

b=rand(3,10)

c=rand(5,6)

d=rand(5,8)

e=cat(2,a,b)

José Guillermo Valeriano Leaño


f=cat(2,c,d)

x=cat(1,e,f)

round(x)

Parte 5
a)

u=round(0+(64-0)*rand(8));

a=u(1:4,1:4);

b=u(1:4,5:8);

c=u(5:8,1:4);

d=u(5:8,5:8);

Parte 6
a+d

ans =

64 21 57 60

48 64 120 49

36 58 32 70

88 44 92 95

c+b

ans =

89 50 41 34

52 106 82 68

65 63 56 49

17 62 51 37

a-c

ans =

-16 -19 22 -6

-6 -38 18 -36

José Guillermo Valeriano Leaño


1 -5 -29 0

22 -26 39 54

a-b

ans =

-5 -11 19 4

-4 -32 22 -4

-52 -2 3 37

39 32 -4 17

3*b

ans =

117 63 66 36

75 150 117 54

177 90 36 18

0 6 141 111

>> inv(a)

ans =

-0.1393 0.0155 -0.1646 0.1683

-0.6187 0.1550 -0.5071 0.5469

0.1444 -0.0119 0.1294 -0.1427

0.3752 -0.0993 0.3351 -0.3338

>> inv(b)

ans =

0.0344 -0.0145 0.0004 -0.0042

-0.1096 0.0296 0.0599 0.0114

0.2798 -0.0056 -0.1825 -0.0584

-0.3494 0.0056 0.2286 0.1006

>> inv(c)

ans =

0.0274 -0.0127 0.0007 -0.0018

-0.0107 0.0121 -0.0086 0.0153

José Guillermo Valeriano Leaño


0.0440 -0.1275 0.1257 0.0286

-0.0407 0.1229 -0.0989 -0.0407

>> inv(d)

ans =

-0.0323 -0.0283 0.0456 0.0288

-0.0094 0.0075 0.0309 -0.0166

-0.0075 0.0175 -0.0279 0.0114

0.0498 0.0110 -0.0287 -0.0196

Parte 7
x=0+(255-0)*rand(8);
image(x);
colormap(gray(255));
title('Imagen de Matriz de 8x8')
xlabel('Columnas')
ylabel('Filas')
imshow(x,[0 70])
axis auto

Parte 8
a=imread('D:\descarga.bmp')
whos a
b=im2double(a);
image(b)

José Guillermo Valeriano Leaño

Vous aimerez peut-être aussi