Você está na página 1de 23

UNIVERSIDAD POLITÉCNICA SALESIANA

FACULTAD DE CIENCIAS TECNICAS

INGENIERIA ELÉCTRICA

SEÑALES Y SISTEMAS

HERNÁN QUINCHIMBLA

PRACTICA Nº 01

Objetivo:
Familiarizarse con el manejo del programa MATLAB.

Aplicación de comandos a ser utilizados

Realizar ejercicios de aplicación

Realización de la Práctica:

>> A=[16 3 2 13;5 10 11 8;9 6 7 12;4 15 14 1]

A=

16 3 2 13

5 10 11 8

9 6 7 12

4 15 14 1

>> sum(A)

ans =
34 34 34 34

>> A'

ans =

16 5 9 4

3 10 6 15

2 11 7 14

13 8 12 1

>> diag(A)

ans =

16

10

>> fliplr(A)

ans =

13 2 3 16

8 11 10 5

12 7 6 9
1 14 15 4

>> A(1,4)+A(2,4)+A(3,4)+(4,4)

>> A(1,4)+A(2,4)+A(3,4)+A(4,4)

ans =

34

>> A(4,5)

??? Attempted to access A(4,5); index out of bounds because size(A)=[4,4].

>> X=[16 3 2 13;5 10 11 8;9 6 7 12;4 15 14 1]

X=

16 3 2 13

5 10 11 8

9 6 7 12

4 15 14 1

>> X(4,5)=17

X=

16 3 2 13 0
5 10 11 8 0

9 6 7 12 0

4 15 14 1 17

>> 1:10

ans =

1 2 3 4 5 6 7 8 9 10

>> 100:-7:50

ans =

100 93 86 79 72 65 58 51

>> 0:pi/4:pi

ans =

0 0.7854 1.5708 2.3562 3.1416

>> sum(A(1:4,4))

ans =

34
>> B=magic(4)

B=

16 2 3 13

5 11 10 8

9 7 6 12

4 14 15 1

>> A=B(:,[1 2 3 4])

A=

16 2 3 13

5 11 10 8

9 7 6 12

4 14 15 1

>> A=B(:,[1 3 2 4])

A=

16 3 2 13

5 10 11 8

9 6 7 12

4 15 14 1
>> A=B(:,[4 2 3 1])

A=

13 2 3 16

8 11 10 5

12 7 6 9

1 14 15 4

>> num_estudiantes=25

num_estudiantes =

25

>> rho=(1+sqrt(5))/2

rho =

1.6180

>> a=abs(3+4i)

a=

5
>> Z=sqrt(besselk(4/3,rho-i))

Z=

0.3730 + 0.3214i

>> huge=exp(log(realmax))

huge =

1.7977e+308

>> toobig=pi*huge

toobig =

Inf

>> Z=zeros(2,4)

Z=

0 0 0 0

0 0 0 0

>> F=5*ones(3,3)
F=

5 5 5

5 5 5

5 5 5

>> N=fix(10*rand(1,10))

N=

8 9 1 9 6 0 2 5 9 9

>> R=randn(4,4)

R=

-1.3499 0.7147 1.4090 0.7172

3.0349 -0.2050 1.4172 1.6302

0.7254 -0.1241 0.6715 0.4889

-0.0631 1.4897 -1.2075 1.0347

>> magic.dat=[16 3 2 13;5 10 11 8;9 6 7 12;4 15 14 1]

magic =

dat: [4x4 double]


>> load magic.dat

??? Error using ==> load

Unable to read file magic.dat: No such file or directory.

>> load magik.dat

??? Error using ==> load

Unable to read file magik.dat: No such file or directory.

>> T=[16 3 2 13;5 10 11 8;9 6 7 12;4 15 14 1]

T=

16 3 2 13

5 10 11 8

9 6 7 12

4 15 14 1

>> H=magic(4)

??? Index exceeds matrix dimensions.

>> H=magic(3)

??? Index exceeds matrix dimensions.

>> H=magic(5)

??? Index exceeds matrix dimensions.


>> T=[16 3 2 13;5 10 11 8;9 6 7 12;4 15 14 1]

T=

16 3 2 13

5 10 11 8

9 6 7 12

4 15 14 1

>> p=magic(4)

??? Index exceeds matrix dimensions.

>> B=magic(4)

??? Index exceeds matrix dimensions.

>> load magic.dat

??? Error using ==> load

Unable to read file magic.dat: No such file or directory.

>> load magic.dat

>> magic

magic =

16 3 2 13

5 10 11 8

9 6 7 12
4 15 14 1

>> B=[A A+32;A+48 A+16]

B=

13 2 3 16 45 34 35 48

8 11 10 5 40 43 42 37

12 7 6 9 44 39 38 41

1 14 15 4 33 46 47 36

61 50 51 64 29 18 19 32

56 59 58 53 24 27 26 21

60 55 54 57 28 23 22 25

49 62 63 52 17 30 31 20

>> X(:,2)=[]

X=

16 2 13 0

5 11 8 0

9 7 12 0

4 14 1 17

>> A = [16 3 2 13;5 10 11 8;9 6 7 12;4 15 14 1 ]

A=
16 3 2 13

5 10 11 8

9 6 7 12

4 15 14 1

>> A + A'

ans =

32 8 11 17

8 20 17 23

11 17 14 26

17 23 26 2

>> A*A'

ans =

438 236 332 150

236 310 278 332

332 278 310 236

150 332 236 438

>> d = det(A)

d=
0

>> B = [ 1 2 3 4; 5 6 7 8; 1 2 4 4 ; 1 1 3 7]

B=

1 2 3 4

5 6 7 8

1 2 4 4

1 1 3 7

>> C = inv(B)

C=

-1.7500 0.4167 0.3333 0.3333

2.1250 -0.1250 -1.0000 -0.5000

-1.0000 0 1.0000 0

0.3750 -0.0417 -0.3333 0.1667

>> x = [4/3 1.2345e-6]

x=

1.3333 0.0000
>> format short

>> x

x=

1.3333 0.0000

>> format short g

>> x

x=

1.3333 1.2345e-006

>> format long

>> x

x=

1.333333333333333 0.000001234500000

>> format bank

>> x

x=

1.33 0.00
>> format rat

>> x

x=

4/3 1/810045

>> format hex

>> x

x=

3ff5555555555555 3eb4b6231abfd271

>> A = magic(100);

??? Attempted to access magic(100); index out of bounds because

numel(magic)=16.

>> A = magic(16);

>> x=0:pi/100:2*pi;

>> y = sin(x);

>> plot(x,y)
>> xlabel('x = 0:2\pi')

>> ylabel('Sine of x')

>> title('Plot of the Sine Function','FontSize',12)


x = 0:pi/100:2*pi;

y = sin(x);

y2 = sin(x-.25);

y3 = sin(x-.5);

plot(x,y,x,y2,x,y3)
x1 = 0:pi/100:2*pi;

x2 = 0:pi/10:2*pi;

plot(x1,sin(x1),'r:',x2,sin(x2),'r+')
>> t = 0:pi/10:2*pi;

plot(exp(i*t),'-o')

axis equal

[x,y,z] = peaks;

pcolor(x,y,z)

shading interp

hold on

contour(x,y,z,20,'k')

hold off
t = 0:pi/10:2*pi;

[X,Y,Z] = cylinder(4*cos(t));

subplot(2,2,1); mesh(X)

subplot(2,2,2); mesh(Y)

subplot(2,2,3); mesh(Z)

subplot(2,2,4); mesh(X,Y,Z)

t = -pi:pi/100:pi;

y = sin(t);

plot(t,y)

axis([-pi pi -1 1])

xlabel('-\pi \leq {\itt} \leq \pi')


ylabel('sen(t)')

title('Grafica de la función seno')

text(1,-1/3,'{\itNote la simetria impar.}')

r = zeros(1,32);
for n = 3:32
r(n) = rank(magic(n));
end
r
bar(r)

r=

Columns 1 through 11
0 0 3 3 5 5 7 3 9 7 11

Columns 12 through 22

3 13 9 15 3 17 11 19 3 21 13

Columns 23 through 32

23 3 25 15 27 3 29 17 31 3

function x = potdos(y);

% la siguiente función eleva el valor de 2^x


x = 2^y

s=

>> potdos(s)

x=

256

ans =

256

Você também pode gostar