Академический Документы
Профессиональный Документы
Культура Документы
Electrnica
UNIVERSIDAD NACIONAL DE SAN AGUSTIN FACULTAD DE PRODUCCION Y SERVICIOS ESCUELA PROFESIONAL DE INGENIERIA ELECTRONICA
PRESENTADO POR:
AREQUIPA PERU
2010
1
Ing. Electrnica
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()
5 tiempo(s)
10
Ing. Electrnica
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
Imaginary Axis
-50
0.5 0 -0.5 -1 -8
10
10
10
-6
-4 Real Axis
-2
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
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
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()
100
200
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
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)
Pole-Zero Map 1
Imaginary Axis Phase (deg) Magnitude (dB)
0.5 0 -0.5 -1 -1
10
10
Frequency (rad/sec)
Amplitude
0.5
2 Time (sec)
H2
2 s 1s 2 (s)=
Ing. Electrnica
subplot(2,2,3) step(g)
Pole-Zero Map 1
Bode Diagram
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
H3
1 s2 2 s 1 (s)=
10
Ing. Electrnica
step(g)
Pole-Zero Map 1
Bode Diagram
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)
Amplitude
-0.5
-1
2 Time (sec)
H4
1 s2 2 s 1 (s)=
11
Ing. Electrnica
Pole-Zero Map 1
Bode Diagram
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)
25 H(5)= -------------s^2 + 2 s + 25
12
Ing. Electrnica
Pole-Zero Map 5
Imaginary Axis
-5 -1
10
10
10
Frequency (rad/sec)
2 1.5
Amplitude
1 0.5 0
4 Time (sec)
13
Ing. Electrnica
Pole-Zero Map 5
Bode Diagram
50 0 -50 90 0 -90 -1 10
0 1 2
Imaginary Axis
-5 -1
10
10
10
Frequency (rad/sec)
Amplitude
-2
2 Time (sec)
5 s + 25 H7= -------------s^2 + 2 s + 25
14
Ing. Electrnica
Pole-Zero Map 5
Imaginary Axis
-5 -6
-4
-2 Real Axis
10
10
10
Frequency (rad/sec)
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
Bode Diagram
Phase (deg) Magnitude (dB)
Pole-Zero Map 5
Imaginary Axis
10
10
-5 -1.5
-1
Amplitude
0.5
2 Time (sec)
-0.5
0 Real Axis
0.5
16