Documentos de Académico
Documentos de Profesional
Documentos de Cultura
LAB 2
LABORATORIO
DE CONTROL AUTOMATICO I
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(1t=2)
1 CREAMOS UN FILE edo1.m DONDE SE DEFINE LA ECUACIN:
function[ydot]=edol1(y) ydot=(1-y)/2;
2 CREAMOS OTRO FILE IMPLEMENTANDO EL ALGORITMO SIGUIENTE Y LO GUARDAMOS CON EL NOMBRE euler_ode1.m
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)=edol1(y(i)); y(i+1)=y(i)+h*ydot(i); ye(i+1)=1-exp(-t(i+1)/2); end ydot(n+1)=edol1(y(n+1)); plot(t,y,t,ye,'r:'); legend('Solucin numerica-euler','Solucin exacta'); title('Comparacion entre la solucin exacta y la solucin numerica'); xlabel('Tiempo(s)'); ylabel('Amplitud()');
Ejecutar la simulacin, en el workspace donde se ha de digitar euler_ode1 y ese obtendr la siguiente grafica:
LAB 2
g (s) =
16 s + 9 s + 16
2
Luego se hallamos ciertas caractersticas de esta; >> g=tf([16],[1 9 16]); >> subplot(221); >> bode(g); >> subplot(222); >> pzmap(g); >> subplot(223); >> step(g); >> subplot(224); %respuesta al escaln unitario %grafico de polos y ceros %diagrama de bode %definimos nuestro sistema
>> nyquist(g);
3.
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. 1 Creamos El File Rk4.M Con El Siguiente Contenido: function [ydot]=edo1(y); ydot=(1-y)/2; 2 En Otro File Digitamos El Algoritmo. x(1)=0; tf=10 y(1)=0; ye(1)=0; h=0.5; n=round(tf/h);
LAB 2
for i=1:n; k1=2*(1-y(i))/2; k2=(1-y(i)-h/2*k1)/2; k3=(1-y(i)-h/2*k2)/2; k4=(1-y(i)-h*k3)/2; y(i+1)=y(i)+h/6*(k1+2*k2+2*k3+k4); x(i+1)=x(i)+h; ye(i+1)=1-exp(-x(i+1)/2); end ydot(n+1)=rk4(y(n+1)); plot(x,y,x,ye,'r:'); legend('solucin numrica-RK4','solucin exacta'); title('Comparacin entre la solucin exacta y la solucin numrica') xlabel('Tiempo(s)') ylabel('Amplitud( )') SE OBTIENE EL SIGUIENTE GRAFICO:
4.
REPETIR
LAB 2
ye (t ) =
1 1e
2.5t +0.9
function[ydot]=edo1(y) ydot=2.5*y*(1-y) EN OTRO FILE DEFINIMOS EL ALGORITMO PARA HALLAR LA SOLUCIN DE LA ECUACIN DIFERENCIAL. 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(-2.5*t(i+1)+0.9))^(-1); end ydot(n+1)=edo1(y(n+1)); plot(t,y,t,ye,'r:'); legend('Solucin numerica-euler','solucin exacta')
LAB 2
5.
G1
+ R H
G2 +
+ C
LAB 2
Solucin G1 R G2 H C
+ R H G2
G1 G2
G2 1 + G 2 .H
1+
G1 G2
G 2 + G1 1 + G2 * H
6.
FUNCIONES DE TRANSFERENCIA, SU REPRESENTACIN Y RESPUESTA. UD. PODR EXPLORAR LA RELACIN ENTRE LA LOCALIZACIN DE POLOS Y CEROS, LA RESPUESTA TEMPORAL Y LA RESPUESTA FRECUENCIAL. POR TANTO, PARA LAS SIGUIENTES FUNCIONES DE TRANSFERENCIA GRAFIQUE (I)EL DIAGRAMA DE POLOS Y CEROS (II) EL DIAGRAMA DE BODE Y (III) LA RESPUESTA ESCALN UNITARIO. A) Sistema de primer orden: H 1 ( s) = 1 s +1
LAB 2
H 2 (s) =
( s +1)( s + 2)
LAB 2
1.
H 3 ( s) =
LAB 2
2.
H 4 ( s) =
1 ( s + 2) 2 ( s + 1)
LAB 2
H 5 ( s) =
>>h=tf(25,[1 2 25]) ; >>subplot(2,2,1) ; >>pzmap(g) ; >>subplot(2,2,2) ; >>bode(g) ; >>subplot(2,2,3) ; >>step(g) ;
25 s + 2 s + 25
2
LAB 2
H 6 ( s) =
25s s + 2 s + 25
2
LAB 2
f)
H 7 ( s) =
>>h=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) ;
5s + 25 s + 2 s + 25
2