Documentos de Académico
Documentos de Profesional
Documentos de Cultura
CURSO
TEMA
: Simulacin Numrica
ALUMNOS
2009
1.
y =
[ 1 y ( t ) ]
2
y e ( t )=1e
t
(1 )
2
Definimos d1.m
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('Comparacin entre la Solucin Exacta y la Solucin Numerica')
xlabel('tiempo');ylabel('amplitud')
Grfica
Solucin Exacta
Solucin Numerica-Euler
0.9
0.8
0.7
amplitud
0.6
0.5
0.4
0.3
0.2
0.1
0
5
tiempo
10
2.
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)
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)
Bode Diagram
0
-50
-100
0
-90
-180
0.5
0
-0.5
-1
-8
10
Pole-Zero Map
1
Imaginary Axis
Transfer Function
16
2
s + 9 s+16
10
-6
-4
Step Response
Imaginary Axis
Amplitude
0.5
0.5
1.5
Time (sec)
Real Axis
Frequency (rad/sec)
1
-2
2.5
Nyquist Diagram
0.5
0
-0.5
-1
-1
-0.5
0
Real Axis
0.5
3.
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;
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( )')
solucion exacta
solucion numerica-euler
0.9
0.8
amplitud()
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
4.
5
tiempo(s)
10
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
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()')
1.3
solucion exacta
solucion numerica-euler
1.2
1.1
amplitud()
1
0.9
0.8
0.7
0.6
0.5
0.4
0
5.
100
200
300
400
tiempo(s)
500
600
700
+
R
G2
Solucin:
C
C
R
R
G2
1+G2*H
G1+G2
1+G2*H
1+G1
G2
Bode Diagram
Imaginary Ax is
Phas e (deg)
Magnitude (dB)
g=tf([1],[1 1])
subplot(2,2,1)
bode(g)
subplot(2,2,2)
pzmap(g)
subplot(2,2,3)
step(g)
subplot(2,2,4)
nyquist(g)
-20
-40
0
-45
-90
-2
10
0.5
0
-0.5
-1
-1
10
Pole-Zero Map
10
-0.5
Step Response
Imaginary Ax is
0.5
2
Time (sec)
Real Axis
Frequency (rad/sec)
Am plitude
6.
Nyquist Diagram
0.5
0
-0.5
-1
-1
-0.5
0
Real Axis
0.5
b)
Transfer function:
2
---------------s^2 + 3 s + 2
Bode Diagram
-50
Imaginary Axis
g=tf([2],[1 3 2])
subplot(2,2,1)
bode(g)
subplot(2,2,2)
pzmap(g)
subplot(2,2,3)
step(g)
subplot(2,2,4)
nyquist(g)
-100
0
-90
-180
-2
10
0.5
0
-0.5
-1
-2
10
10
Pole-Zero Map
-1.5
Step Response
Imaginary Axis
Amplitude
0.5
2
Time (sec)
-0.5
Real Axis
Frequency (rad/sec)
1
-1
Nyquist Diagram
0.5
0
-0.5
-1
-1
-0.5
0
Real Axis
0.5
c1)
Transfer function:
s-2
------2s+1
Bode Diagram
10
Imaginary Axis
-10
180
90
0
-2
10
0.5
0
-0.5
-1
-1
10
Pole-Zero Map
10
Step Response
Imaginary Axis
Amplitude
0
-1
-2
5
Time (sec)
10
Real Axis
Frequency (rad/sec)
1
Nyquist Diagram
1
0
-1
-2
-2
-1
0
Real Axis
c2)
Transfer function:
s+2
------2s+1
Bode Diagram
10
Imaginary Axis
-10
0
-20
-40
-2
10
0.5
0
-0.5
-1
-2
10
10
Pole-Zero Map
-1.5
-1
Frequency (rad/sec)
Step Response
1
Imaginary Axis
Amplitude
2
1.5
1
0.5
5
Time (sec)
10
-0.5
Real Axis
Nyquist Diagram
0.5
0
-0.5
-1
-1
1
Real Axis
d)
Transfer function:
25
-------------s^2 + 2 s + 25
Bode Diagram
100
0
-100
0
-90
-180
-1
10
10
10
Pole-Zero Map
5
Imaginary Axis
g=tf([25],[1 2 25])
subplot(2,2,1)
bode(g)
subplot(2,2,2)
pzmap(g)
subplot(2,2,3)
step(g)
subplot(2,2,4)
nyquist(g)
-5
-1
10
-0.5
Frequency (rad/sec)
Step Response
Imaginary Axis
Amplitude
1
0.5
0
2
Time (sec)
Nyquist Diagram
1.5
Real Axis
2
0
-2
-4
-2
-1
0
Real Axis
e)
Transfer function:
25 s
-------------s^2 + 2 s + 25
Bode Diagram
50
0
-50
90
0
-90
-1
10
10
10
Pole-Zero Map
5
Imaginary Axis
-5
-1
10
-0.5
Real Axis
Frequency (rad/sec)
Step Response
2
0
-2
2
Time (sec)
Nyquist Diagram
10
Imaginary Axis
Amplitude
5
0
-5
-10
-5
5
Real Axis
10
15
f)
Transfer function:
5 s + 25
-------------s^2 + 2 s + 25
Bode Diagram
50
Imaginary Axis
Phase (deg)
Magnitude (dB)
-50
180
0
-180
-1
10
10
10
-5
-6
10
Pole-Zero Map
-4
Step Response
4
Imaginary Axis
Amplitude
1.5
1
0.5
0
2
Time (sec)
Real Axis
Frequency (rad/sec)
2
-2
Nyquist Diagram
2
0
-2
-4
-2
2
Real Axis
g1)
Transfer function:
25
----------------------s^3 + 3 s^2 + 27 s + 25
Bode Diagram
-50
Imaginary Axis
g=tf([25],[1 3 27 25])
subplot(2,2,1)
bode(g)
subplot(2,2,2)
pzmap(g)
subplot(2,2,3)
step(g)
subplot(2,2,4)
nyquist(g)
-100
0
-180
-360
-2
10
-5
-1.5
10
10
Pole-Zero Map
-1
Step Response
Imaginary Axis
Amplitude
0.5
2
Time (sec)
Real Axis
Frequency (rad/sec)
1
-0.5
Nyquist Diagram
0.5
0
-0.5
-1
-1
-0.5
0
Real Axis
0.5
g2)
Transfer function:
125
-----------------------s^3 + 7 s^2 + 30 s + 125
Bode Diagram
200
Imaginary Axis
g=tf([125],[1 7 30 125])
subplot(2,2,1)
bode(g)
subplot(2,2,2)
pzmap(g)
subplot(2,2,3)
step(g)
subplot(2,2,4)
nyquist(g)
-200
0
-180
-360
-5
-6
10
10
Pole-Zero Map
-4
Step Response
Imaginary Axis
Amplitude
1
0.5
0
4
Time (sec)
Real Axis
Frequency (rad/sec)
1.5
-2
Nyquist Diagram
2
0
-2
-4
-4
-2
0
Real Axis