You are on page 1of 13

Control Automático de Procesos.

Trabajo Práctico de Gabinete N° 1: Práctica intensiva de Introducción a Matlab.


Alumna: Quevedo Sol Agustina

>> A = [1,2,3
4,5,6
7,8,9]

A=

1 2 3
4 5 6
7 8 9

>> A(1,2)

ans =

>> VECTOR = [1,2,3]

VECTOR =

1 2 3

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

MATRIZ =

1 2 3
4 5 6
7 8 9

>> 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

>> 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

>> MATRIZ2 = [1 2 3
123
1 2 3]

MATRIZ2 =

1 2 3
1 2 3
1 2 3

>> C = MATRIZ * MATRIZ2

C=

6 12 18
15 30 45
24 48 72

>> D = MATRIZ .* MATRIZ2

D=

1 4 9
4 10 18
7 16 27

>> det(MATRIZ)
ans =

6.6613e-16
>> det (C)

ans =

>> det (MATRIZ2)

ans =

>> inv(C)
Warning: Matrix is singular to working precision.

ans =

Inf Inf Inf


Inf Inf Inf
Inf Inf Inf

>> C(:,2)

ans =

12
30
48

>> VECTOR2 = 2*VECTOR

VECTOR2 =

2 4 6

>> VECTOR2(:,2)

ans =

>> P=[1,3,-2,0,1]
P=

1 3 -2 0 1

>> roots(P)

ans =

-3.5421 + 0.0000i
0.5446 + 0.4685i
0.5446 - 0.4685i
-0.5470 + 0.0000i

raices =

-3.5421 + 0.0000i
0.5446 + 0.4685i
0.5446 - 0.4685i
-0.5470 + 0.0000i

>> polyval (P,raices)

ans =

1.0e-12 *

-0.2807 + 0.0000i
0.0011 + 0.0003i
0.0011 - 0.0003i
0.0002 + 0.0000i

>> P2 = [3 4 5]

P2 =

3 4 5

>> P3 = [2 1 2]

P3 =

2 1 2

>> PP = conv(P2,P3)

PP =
6 11 20 13 10

>> [Q,R] = deconv (P2,P3)

Q=

1.5000

R=

0 2.5000 2.0000

>>
>> a=[2, 3; 5, -2]

a=

2 3
5 -2

>> b=[4; 6]

b=

4
6

>> s=inv(a)*b

s=

1.3684
0.4211

>> t=solve('2*x^2+3*x-2')

t=

-2
1/2

>> [a,b] = solve('a^2 + a*b - b = 3','a^2 - 4*b - 5 = 0')

a=
-1
- 2*2^(1/2) - 1
2*2^(1/2) - 1

b=

-1
2^(1/2) + 1
1 - 2^(1/2)

>> y=dsolve('Dy-x-y=0','y(0)=1', 'x')

y=

2*exp(x) - x - 1

>> ezplot(y, 0, 2);


grid on

>> int(sym('x*sin(x)'))

ans =

sin(x) - x*cos(x)

>> s=int(sym('x*sin(x)'),0,pi)
s=

pi

>> syms x
>> y=x^3-8

y=

x^3 - 8

>> t=factor(y)

t=

(x - 2)*(x^2 + 2*x + 4)

>> e=taylor(exp(x),x, 5)

e=

exp(5) + exp(5)*(x - 5) + (exp(5)*(x - 5)^2)/2 + (exp(5)*(x - 5)^3)/6 + (exp(5)*(x - 5)^4)/24 + (exp(5)*(x -


5)^5)/120

>> e=taylor(exp(x),x, 5)

e=

exp(5) + exp(5)*(x - 5) + (exp(5)*(x - 5)^2)/2 + (exp(5)*(x - 5)^3)/6 + (exp(5)*(x - 5)^4)/24 + (exp(5)*(x -


5)^5)/120

>> f='2*t+1'; t=3

t=

>> y=eval(f)

y=

>> f=3*x^2+5*x

f=
3*x^2 + 5*x

>> t=factor(f)
s=expand(t)

t=

x*(3*x + 5)

s=

3*x^2 + 5*x

>>
>> limit(sin(x)/x)

ans =

>> x=-4:.01:4; y=sin(x); plot(x,y)

>> x=-1.5:.01:1.5; y=exp(-x.^2); plot(x,y)


>> t=0:.001:2*pi; x=cos(3*t); y=sin(2*t); plot(x,y)

>> function y=expcu(x)


>> fplot ('expcu', [-1.5,1.5])
>> t=.01:.01:2*pi; x=cos(t); y=sin(t); z=t.^3; plot3(x,y,z)

>> mesh(eye(10))
>> xx=-2:.2:2;
yy=xx

yy =

Columns 1 through 11

-2.0000 -1.8000 -1.6000 -1.4000 -1.2000 -1.0000 -0.8000 -0.6000 -0.4000 -0.2000 0

Columns 12 through 21

0.2000 0.4000 0.6000 0.8000 1.0000 1.2000 1.4000 1.6000 1.8000 2.0000

>> [x,y]=meshgrid(xx,yy);
z=exp(-x.^2-y.^2);
mesh(z)
>> colormap(cool)

>> shading flat


>> colormap (jet)