Вы находитесь на странице: 1из 16

Ing.

Electrnica

laboratorio de teora de control automtico

UNIVERSIDAD NACIONAL DE SAN AGUSTIN FACULTAD DE PRODUCCION Y SERVICIOS ESCUELA PROFESIONAL DE INGENIERIA ELECTRONICA

LABORATORIA DE TEORIA DE CONTROL AUTOMATICO 1

TEMA: Simulacin numrica

PRESENTADO POR:

Quispe merma jonathan fran

AREQUIPA PERU

2010
1

Ing. Electrnica

laboratorio de teora de control automtico

PRCTICA NMERO 2 SIMULACION NUMERICA 1. Ecuaciones diferenciales (repetir la siguiente actividad). Determine la ecuacin diferencial y=[1-y(t)]/2 usando el mtodo de Euler. Plotear el grafico de y(t), en funcin de t, y el grafico de la solucin exacta ye(t) en funcin de t.

Instante inicial: t=0 Instante final: tf=10 Solucin exacta de la ecuacin diferencial: ye(t) =1-e^(1-t/2) function[ydot]=edo1(y) ydot=(1-y)/2 t(1)=0; tf=10; y(1)=0; ye(1)=0; h=0.5; n=round(tf/h); for i=1:n t(i+1)=t(i)+h; ydot(i)=edo1(y(i)); y(i+1)=y(i)+h*ydot(i); ye(i+1)=1-exp(-t(i+1)/2); end ydot(n+1)=edo1(y(n+1)); plot(t,y,t,ye,'r:'); legend('solucin exacta','solucin numerica-euler') title('comparacion entre la solucin exacta y la solucin numerica') xlabel('tiempo(s)');ylabel('amplitud()') euler_ode1

Ing. Electrnica
comparacion entre la solucion exacta y la solucion numerica 1 0.9 0.8 0.7 0.6
amplitud()

laboratorio de teora de control automtico


solucion exacta solucion numerica-euler

0.5 0.4 0.3 0.2 0.1 0

5 tiempo(s)

10

2. Repita las instrucciones: F.T. H(s)=1/(s+1) h=tf(1,[1 1])

g=ss([0 1;-5 -2],[0;3],[0 1],0)

[num,den]=ss2tf([0 1;-5 -2],[0;3],[0 1],0)

Ing. Electrnica

laboratorio de teora de control automtico

g=tf(16,[1 9 16]) subplot(2,2,1) bode(g) subplot(2,2,2) pzmap(g) subplot(2,2,3) step(g) subplot(224) nyquist(g)

Ing. Electrnica
Bode Diagram

laboratorio de teora de control automtico


Pole-Zero Map 1

Phase (deg) Magnitude (dB)

-100 0 -90 -180 -1 10


0 1 2

Imaginary Axis

-50

0.5 0 -0.5 -1 -8

10

10

10

-6

-4 Real Axis

-2

Frequency (rad/sec) Step Response 1 1

Nyquist Diagram

0.5

Imaginary Axis
0 0.5 1 1.5 2 2.5

0.5 0 -0.5 -1 -1

Amplitude

-0.5

0 Real Axis

0.5

Time (sec)

3. Ejercicio: Realice la simulacin numrica de la ecuacin diferencial descrita en el item1; Esta vez implemente el algoritmo RK4, en ves del mtodo euler. Haga una comparacin entre las soluciones: exacta, euler y RK4. function[f]=rk(x,y); f=(1-y)/2; x(1)=0; tf=10 y(1)=0; ye(1)=0; h=0.5; n=round(tf/h); for i=1:n; k1=f(x(i),y(i)); k2=f(x(i)+h/2,y(i)+h/2*k1); k3=f(x(i)+h/2,y(i)+h/2*k2); k4=f(x(i)+h,y(i)+h*k3); y(i+1)=y(i)+h/6*(k1+2*k2+2*k3+k4); x(i+1)=x(i)+h;

Ing. Electrnica

laboratorio de teora de control automtico

ye(i+1)=1-exp(-t(i+1)/2); end ydot(n+1)=rk(y(n+1)); plot(x,y,x,ye,'r:'); legend('solucin exacta','solucin numerica-Euler'); title('Comparacion entre la solucin exacta y la solucin numerica') xlabel('Tiempo(s)') ylabel('Amplitud( )')

4. Ejercicio: Repetir uno , usando la ecuacin diferencial (no lineal) siguiente: y=2.5[y(1-y)] y(0)=0.9 Condicin inicial h=0.85 paso tf=600s instante final :

function[ydot]=edo1(y) ydot=2.5*y*(1-y)

t(1)=0; tf=600; y(1)=0.9; ye(1)=0.9; h=0.85; n=round(tf/h); for i=1:n t(i+1)=t(i)+h; ydot(i)=edo1(y(i)); y(i+1)=y(i)+h*ydot(i); ye(i+1)=1-exp(-t(i+1)/2); end

Ing. Electrnica

laboratorio de teora de control automtico

ydot(n+1)=edo1(y(n+1)); plot(t,y,t,ye,'r:'); legend('solucin exacta','solucin numerica-euler') title('comparacion entre la solucin exacta y la solucin numerica') xlabel('tiempo(s)');ylabel('amplitud()')

euler_ode1
comparacion entre la solucion exacta y la solucion numerica 1.3 1.2 1.1 1 0.9 solucion exacta solucion numerica-euler

amplitud()

0.8 0.7 0.6 0.5 0.4

100

200

300 400 tiempo(s)

500

600

700

5. Ejercicio: reducir el diagrama de bloques de la figura 2 y expresar la F.T. entre C y R en funcin de ( G1,G2 y H ).

G1 C

+ R H
Solucin:

G2

Ing. Electrnica

laboratorio de teora de control automtico

G1 R + + H G1 G2 + + H G2 + G2 + + C

+ C

G2 1+G2*H

1+G1 G2

G1+G2 1+G2*H

6. Ejercicio: el propsito de estos ejercicios es familiarizarse con las funciones de transferencia, su representacin y respuesta. Ud. Podr explorar la relacin entre la localizacin de polos y zeros, la respuesta temporal y la respuesta frecuencial.Por tanto, para las siguientes funciones de transferencia grafique (i)el diagrama de polos y zeros (ii)el diagrama de bode y (iii)la respuesta escaln unitario. a) Sistema de primer orden:

1 H1(s)= s 1

Ing. Electrnica
g=tf(1,[1 1]) subplot(2,2,1) pzmap(g) subplot(2,2,2) bode(g) subplot(2,2,3) step(g)

laboratorio de teora de control automtico

Pole-Zero Map 1
Imaginary Axis Phase (deg) Magnitude (dB)

Bode Diagram 0 -20 -40 0 -45 -90 -2 10


0 2

0.5 0 -0.5 -1 -1

-0.5 Real Axis Step Response

10

10

Frequency (rad/sec)

Amplitude

0.5

2 Time (sec)

b) Sistema de segundo orden:

H2

2 s 1s 2 (s)=

g=tf(2,[conv([1 1],[1 2])]) subplot(2,2,1) pzmap(g) subplot(2,2,2) bode(g)

Ing. Electrnica
subplot(2,2,3) step(g)

laboratorio de teora de control automtico

Pole-Zero Map 1

Bode Diagram

Phase (deg) Magnitude (dB)

0 -50 -100 0 -90 -180 -1 10


0 1 2

Imaginary Axis

0.5 0 -0.5 -1 -2

-1.5

-1 Real Axis

-0.5

10

10

10

Frequency (rad/sec)

Step Response 1

Amplitude

0.5

5 Time (sec)

10

c) Sistema de primer orden (adicionamos un zero, primero en el RHP, luego en el LHP):

H3

1 s2 2 s 1 (s)=

g=tf(0.5*[1 -2],[1 1]) subplot(2,2,1) pzmap(g) subplot(2,2,2) bode(g) subplot(2,2,3)

10

Ing. Electrnica
step(g)

laboratorio de teora de control automtico

Pole-Zero Map 1

Bode Diagram

Phase (deg) Magnitude (dB)

0 -5 -10 180 90 0 -1 10
0 1 2

Imaginary Axis

0.5 0 -0.5 -1 -1

0 Real Axis

10

10

10

Frequency (rad/sec)

Step Response 0.5

Amplitude

-0.5

-1

2 Time (sec)

H4

1 s2 2 s 1 (s)=

g=tf(0.5*[1 2],[1 1]) subplot(2,2,1) pzmap(g) subplot(2,2,2) bode(g) subplot(2,2,3) step(g)

11

Ing. Electrnica

laboratorio de teora de control automtico

Pole-Zero Map 1

Bode Diagram

Phase (deg) Magnitude (dB)

0 -5 -10 0 -10 -20 -1 10


0 1 2

Imaginary Axis

0.5 0 -0.5 -1 -2

-1.5

-1 Real Axis

-0.5

10

10

10

Frequency (rad/sec)

Step Response 1

Amplitude

0.8

0.6

0.4

2 Time (sec)

d) El siguiente sistema es un sistema de segundo orden, con Wn=5 y un =0.2

25 H(5)= -------------s^2 + 2 s + 25

g=tf(25,[1 2 25]) subplot(2,2,1) pzmap(g) subplot(2,2,2) bode(g) subplot(2,2,3) step(g)

12

Ing. Electrnica
Pole-Zero Map 5

laboratorio de teora de control automtico


Bode Diagram

Phase (deg) Magnitude (dB)

100 0 -100 0 -90 -180 -1 10


0 1 2

Imaginary Axis

-5 -1

-0.5 Real Axis Step Response

10

10

10

Frequency (rad/sec)

2 1.5

Amplitude

1 0.5 0

4 Time (sec)

e) Ahora adicionamos un cero sobre el origen: 25 s H6 = ----------------s^2 + 2 s + 25

g=tf([25 0],[1 2 25]) subplot(2,2,1) pzmap(g) subplot(2,2,2) bode(g) subplot(2,2,3) step(g)

13

Ing. Electrnica

laboratorio de teora de control automtico

Pole-Zero Map 5

Bode Diagram

Phase (deg) Magnitude (dB)

50 0 -50 90 0 -90 -1 10
0 1 2

Imaginary Axis

-5 -1

-0.5 Real Axis Step Response

10

10

10

Frequency (rad/sec)

Amplitude

-2

2 Time (sec)

e) Ahora adicionamos un cero a 5 rad/seg:

5 s + 25 H7= -------------s^2 + 2 s + 25

g=tf(5*[1 5],[1 2 25]) subplot(2,2,1) pzmap(g) subplot(2,2,2) bode(g) subplot(2,2,3) step(g)

14

Ing. Electrnica
Pole-Zero Map 5

laboratorio de teora de control automtico


Bode Diagram

Magnitude (dB) Phase (deg)

50 0 -50 180 0 -180 -1 10


0 1 2

Imaginary Axis

-5 -6

-4

-2 Real Axis

10

10

10

Frequency (rad/sec)

Step Response 2 1.5

Amplitude

1 0.5 0

2 Time (sec)

f) Un tercer polo es adicionado a H(5), primero a baja frecuencia, y luego a alta frecuencia; 25 125 H8 = ---------------------------------------------s^3 + 3 s^2 + 27 s + 25 125 y H9 = ---------

s^3 + 7 s^2 + 35 s +

g1=tf(25,conv([1 1],[1 2 25])) g2=tf(125,conv([1 5],[1 2 25])) figure(1) subplot(2,2,1) bode(g1) subplot(2,2,2) pzmap(g1) subplot(2,2,3) step(g1) subplot(224) nyquist(g1) figure(2)

15

Ing. Electrnica

laboratorio de teora de control automtico

subplot(2,2,1) bode(g2) subplot(2,2,2) pzmap(g2) subplot(2,2,3) step(g2) subplot(224) nyquist(g2)

Bode Diagram
Phase (deg) Magnitude (dB)

Pole-Zero Map 5
Imaginary Axis

0 -50 -100 0 -180 -360 -2 10


0 2

10

10

-5 -1.5

-1

-0.5 Real Axis

Frequency (rad/sec) Step Response 1


Imaginary Axis

Nyquist Diagram 1 0.5 0 -0.5 -1 -1

Amplitude

0.5

2 Time (sec)

-0.5

0 Real Axis

0.5

16

Вам также может понравиться