Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
x(t)=
Donde se cumple que:
Pregunta 1:
Para determinar el mtodo de euler explicito, hacemos:
( )
( )
)
Si se tiene en cuenta que:
Luego es claro que :
Luego se concluye que:
( )
Se procede de la misma forma para
y se llega a:
( )
Pregunta 2:
Para las preguntas 2 y 3 se creo la siguiente funcin:
function [t j]=funcion(g,l,d,h,x,y,x1,y1,tmax)
%sea d=k/m
%Numero de veces que se repite el ciclo for
n=ceil(tmax/h);
%Inicializando un vector y una matriz, con ceros
t=zeros(1,n);
j=zeros(2,n);
%Valores iniciales
j(1,1)=x;
j(1,2)=x1;
j(2,1)=y;
j(2,2)=y1;
t(1,1)=0;
t(1,2)=h;
%Usando euler explicito.
for k=0:n
o=h^2;
p=sqrt(((j(1,k+1).^2)+((j(2,k+1)).^2)));
v=(j(1,k+1))/p;
b=(j(2,k+1))/p;
n=2*(j(1,k+2));
m=2*(j(2,k+2));
z=j(1,k+1);
s=j(2,k+1);
t(1,k+3)=t(1,k+2)+h;
j(1,k+3)=(o*(g-(d*(p-l)*v)))+n-z;
j(2,k+3)=(o*((-d)*(p-l)*b))+m-s;
end
Luego se creo un rutero con el siguiente cdigo:
%Para el caso de h=1
figure(1)
%Generando el grafico
hold on
[t,j]=funcion(9.81,1,1,1,1,1,1,1,250);
plot(t,j)
%Etiquetando el grafico
title('Grfico x(kh) y y(kh)');
xlabel('tiempo'); ylabel('Posicion');
legend('x(kh)', 'y(kh)');
hold off
%Para h=0.1
figure(2)
%Generando el grafico
hold on
[t,j]=funcion(9.81,1,1,0.1,1,1,1,1,250);
plot(t,j)
%Etiquetando el grafico
title('Grfico x(kh) y y(kh)');
xlabel('tiempo'); ylabel('Posicion');
legend('x(kh)', 'y(kh)');
hold off
%Para h=0.01
figure(3)
%Generando el grafico
hold on
[t,j]=funcion(9.81,1,1,0.01,1,1,1,1,250);
plot(t,j)
%Etiquetando el grafico
title('Grfico x(kh) y y(kh)');
xlabel('tiempo'); ylabel('Posicion');
legend('x(kh)', 'y(kh)');
hold off
%Para h=0.001
figure(4)
%Generando el grafico
hold on
[t,j]=funcion(9.81,1,1,0.001,1,1,1,1,250);
plot(t,j)
%Etiquetando el grafico
title('Grfico x(kh) y y(kh)');
xlabel('tiempo'); ylabel('Posicion');
legend('x(kh)', 'y(kh)');
hold off
Y se obtuvieron los siguientes graficos:
Para h=1
Para h=0.1
0 50 100 150 200 250 300
-4
-2
0
2
4
6
8
x 10
38
Grfico x(kh) y y(kh)
tiempo
P
o
s
i
c
i
o
n
x(kh)
y(kh)
0 50 100 150 200 250 300
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
x 10
6
Grfico x(kh) y y(kh)
tiempo
P
o
s
i
c
i
o
n
x(kh)
y(kh)
Para h=0.01
Para h=0.001
0 50 100 150 200 250 300
-30
-20
-10
0
10
20
30
40
50
Grfico x(kh) y y(kh)
tiempo
P
o
s
i
c
i
o
n
x(kh)
y(kh)
0 50 100 150 200 250 300
-5
0
5
10
15
20
25
Grfico x(kh) y y(kh)
tiempo
P
o
s
i
c
i
o
n
x(kh)
y(kh)
Pregunta 3:
Para esta pregunta se uso la funcin anterior ya creada.
Se ejecuto el siguiente cdigo:
figure(1)
%Generando el grafico
hold on
[t,j]=funcion(9.81,1,1,0.001,1,1,1,1,250);
plot(j(1,:),j(2,:))
%Etiquetando el grafico
title('Grfico x(kh) versus y(kh)');
xlabel('x(kh)'); ylabel('y(kh)');
hold off
Y se genero el siguiente grafico:
-5 0 5 10 15 20 25
-2.5
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
Grfico x(kh) versus y(kh)
x(kh)
y
(
k
h
)
Pregunta 4:
Se ingreso el modelo en Simulink, obteniendo el siguiente esquema:
Luego se ejecuto el siguiente rutero en matlab:
figure(1)
hold on
%Generando el grafico de x(t)
plot(tout, x);
%Etiquetando el grafico
title('Grfico x(t) y t');
xlabel('tiempo'); ylabel('x(t)');
hold off
figure(2)
hold on
%Generando el grafico de y(t)
plot(tout, y);
%Etiquetando el grafico
title('Grfico y(t) y t');
xlabel('tiempo'); ylabel('y(t)');
hold off
figure(3)
hold on
%Generando las curvas en el grfico
plot(x, y);
%Etiquetando el grafico
x
y
x''
x'
y''
y'
9.81
g
x
To Workspace1
y
To Workspace
1
u
Math
Functi on3
sqrt
Math
Functi on2
u
2
Math
Functi on1
u
2
Math
Functi on
1
L1
1
L
1
s
Integrator3
1
s
Integrator2
1
s
Integrator1
1
s
Integrator
Di vi de1
Di vi de
Add3
Add2
Add1
Add
-1
-K/M1
-1
-K/M
title('Grfico comparacin x(t) versus y(t)');
xlabel('x(t)'); ylabel('y(t)');
hold off
Y se obtuvieron los siguientes graficos:
0 50 100 150 200 250
0
5
10
15
20
25
Grfico x(t) y t
tiempo
x
(
t
)
0 50 100 150 200 250
-1.5
-1
-0.5
0
0.5
1
1.5
Grfico y(t) y t
tiempo
y
(
t
)
Pregunta 5:
Se utilizo el mismo esquema de simulink, modificando el valor de g a 0.5, luego se procedi a
ejecutar el mismo cdigo anterior y se generaron los siguientes grficos.
0 5 10 15 20 25
-1.5
-1
-0.5
0
0.5
1
1.5
Grfico comparacin x(t) versus y(t)
x(t)
y
(
t
)
0 50 100 150 200 250
0.8
1
1.2
1.4
1.6
1.8
2
2.2
Grfico x(t) y t
tiempo
x
(
t
)
0 50 100 150 200 250
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Grfico y(t) y t
tiempo
y
(
t
)
0.8 1 1.2 1.4 1.6 1.8 2 2.2
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Grfico comparacin x(t) versus y(t)
x(t)
y
(
t
)