Vous êtes sur la page 1sur 11

EJEMPLO 1

>> num=[5 20];

>> den[1 4 20];

>> den=[1 4 20];

>> [z,p,k]=tf2zp(num,den)

z=

-4

p=

-2.0000 + 4.0000i

-2.0000 - 4.0000i

k=

>> [num, den]=zp2tf(z,p,k)

num =

0 5 20

den =
1 4 20

>> G=tf(num, den);

>> G=zpk(z,p,k)

Zero/pole/gain:

5 (s+4)

---------------

(s^2 + 4s + 20)

EJEMPLO 2

>> p=[1 4 4 1 20];

>> r=roots(p);

valores: [-2.654492061231760 + 1.259460282564620i;-2.654492061231760 -


1.259460282564620i;0.654492061231759 + 1.374208047567791i;0.654492061231759 -
1.374208047567791i]

>> p1=-2.6545+1.2595i;

>> p2=-2.6545-1.2595i;

>> p3=0.6545+1.3742i;

>> p4=0.6545-1.3742i;

>> P=poly([p1,p2,p3,p4])

P=

1.0000 4.0000 4.0000 0.9997 20.0002

EJEMPLO 3

>> num=1;

>> den=[1 3 2];

>> impulse(num,den)

GRAFICA 1
>> t=0:0.1:12;

>> impulse(num,den,t)

GRAFICA 2

>> num=4

>> den=[1 0.8 4];

>> step(num,den)

GRAFICA 3

EJEMPLO 4

>> x=[0.1*pi 0.2*pi 0.3*pi 0.4*pi 0.5*pi 0.6*pi 0.7*pi 0.8*pi 0.9*pi pi]

x=

0.3142 0.6283 0.9425 1.2566 1.5708 1.8850 2.1991 2.5133 2.8274 3.1416

>> y=sin(x)

y=

0.3090 0.5878 0.8090 0.9511 1.0000 0.9511 0.8090 0.5878 0.3090 0.0000

>> x(1)

ans =

0.3142

>> x(4)

ans =
1.2566

>> y(5)

ans =

>> y(6)

ans =

0.9511

>> x(1:5)

ans =

0.3142 0.6283 0.9425 1.2566 1.5708

>> x=(0:0.1:1)*pi

x=

0 0.3142 0.6283 0.9425 1.2566 1.5708 1.8850 2.1991 2.5133 2.8274


3.1416

>> x=linspace(0,pi,11);

EJEMPLO 6
>> x=linspace(-1,3);

>> p=[1 4 -7 -10];

>> v=polyval(p,x);

>> plot(x,v),title('x^3+4x^2-7x-10'),xlabel('x')

>> a=[1 2 3 4];b=[1 4 9 16];

>> c=conv(a,b)

c=

1 6 20 50 75 84 64

>> [q,r]=deconv(c,b)

q=

1 2 3 4

r=

0 0 0 0 0 0 0

>> h=polyder(q)

h=

3 4 3

EJEMPLO 6

>> x=linspace(0,4*pi,60);

>> y=sin(x);
>> z=cos(x);

>> figure(1)

>> figure(1)

>> plot(x,y)

>> z=cos(x);

>> figure(2)

>> plot(x,z,x,y)

>>

>> figure (3)

>> plot(x,y,x,y,'*')

>> figure(4)

>> plot(y,z)

>> figure(5)

>> plot(x,y,x,2*y.*z,'--')

>> grid

>> xlabel('Variable Independiente x')

>> ylabel('Variables dependientes')

>> title('2sen(x)cos(x)sen(2x)')

>> figure(6)

>> plot3(y,z,x),grid

ULTIMO

M=

7
>> N=2^M

N=

128

>> n=0:1:N-1;

>> n=0:1:N-1;

>> To=1

To =

>> T=10

T=

10

>> dt=T/N

dt =

0.0781

>> t=n*dt

t=
Columns 1 through 11

0 0.0781 0.1563 0.2344 0.3125 0.3906 0.4688 0.5469 0.6250 0.7031


0.7813

Columns 12 through 22

0.8594 0.9375 1.0156 1.0938 1.1719 1.2500 1.3281 1.4063 1.4844 1.5625
1.6406

Columns 23 through 33

1.7188 1.7969 1.8750 1.9531 2.0313 2.1094 2.1875 2.2656 2.3438 2.4219
2.5000

Columns 34 through 44

2.5781 2.6563 2.7344 2.8125 2.8906 2.9688 3.0469 3.1250 3.2031 3.2813
3.3594

Columns 45 through 55

3.4375 3.5156 3.5938 3.6719 3.7500 3.8281 3.9063 3.9844 4.0625 4.1406
4.2188

Columns 56 through 66

4.2969 4.3750 4.4531 4.5313 4.6094 4.6875 4.7656 4.8438 4.9219 5.0000
5.0781

Columns 67 through 77

5.1563 5.2344 5.3125 5.3906 5.4688 5.5469 5.6250 5.7031 5.7813 5.8594
5.9375
Columns 78 through 88

6.0156 6.0938 6.1719 6.2500 6.3281 6.4063 6.4844 6.5625 6.6406 6.7188
6.7969

Columns 89 through 99

6.8750 6.9531 7.0313 7.1094 7.1875 7.2656 7.3438 7.4219 7.5000 7.5781
7.6563

Columns 100 through 110

7.7344 7.8125 7.8906 7.9688 8.0469 8.1250 8.2031 8.2813 8.3594 8.4375
8.5156

Columns 111 through 121

8.5938 8.6719 8.7500 8.8281 8.9063 8.9844 9.0625 9.1406 9.2188 9.2969
9.3750

Columns 122 through 128

9.4531 9.5313 9.6094 9.6875 9.7656 9.8438 9.9219

>> w=zeros(1,lenght(t));

??? Undefined function or method 'lenght' for input arguments of type 'double'.

>> w=zeros(1,length(t));

>> for i=1:length(w);

if t(i)<To

w(i)=1;
end

end

>> w=dt*fft(w);

>> f=n/T;

>> pos=find(f>=4/To);

>> if~isempty(pos)&(pos(1)<= N/2)

pos=pos(1)

else

pos=floor(length(f)/2);

end

pos =

41

>> else

??? else

Error: Illegal use of reserved keyword "else".

>> subplot(3,1,1)

>> plot(t,w);

Warning: Imaginary parts of complex X and/or Y arguments ignored

>> title('Forma de onda en el tiempo')

>> xlabel('Tiempo (s)')

>> ylabel('w(t)')

>> subplot(3,1,2)

>> plot(f(1:pos),abs(W(1:pos)));

??? Undefined function or method 'W' for input arguments of type 'double'.

>> plot(f(1:pos),abs(W(1:pos)));
??? Undefined function or method 'W' for input arguments of type 'double'.

>> plot(f(1:pos),abs(w(1:pos)))

Vous aimerez peut-être aussi