You are on page 1of 1

Hayler Alberto Camargo Martı́nez.

Departamento de Fı́sica
Herramientas Computacionales
Tarea 8
1 de octubre de 2020

tfinal=10;
N=10000;
tau=tfinal/N;
t(1)=0;y(1)=500;v(1)=0;v1(1)=50;x(1)=0;
for n=1:N
t(n+1)=n*tau;
yhalf=y(n)+v(n)*tau*0.5;
vhalf=v(n)+0.5*(-m*g/c+(m*g/c+v(1))*exp(-(c/m)*tau));
y(n+1)=y(n)+vhalf*tau;
v(n+1)=v(n)+(-m*g/c+(m*g/c+v(1))*exp(-(c/m)*tau));
xhalf=x(n)+v1(n)*tau*0.5;
v1half=v1(n)-(0.5*(v1(1)*(1-exp((-c/m)*tau))));
x(n+1)=x(n)+v1half*tau;
v1(n+1)=v1(n)-(v1(1)*(1-exp((-c/m)*tau)));
end
figure(1);clf;plot(t,y,’r’);grid on;legend(’Y[m]’);
%figure(2);clf;plot(t,x,’b-’);grid on;legend(’X[m]’);
%figure(3);clf;plot(t,v1,’r-’);grid on;legend(’V[m/s]’);
%figure(4);clf;plot(t,v,’g-’);grid on;legend(’Vy[M/s]’);
%figure(5);clf;plot(y,x,’r-’);grid on;legend(’Trayectoria’);
figure(6);clf;
subplot(3,2,1); plot(t,y,’r’);grid on;legend(’Y[m]’);
subplot(3,2,2); plot(t,x,’b-’);grid on;legend(’X[m]’);
subplot(3,2,3); plot(t,v1,’r-’);grid on;legend(’V[m/s]’);
subplot(3,2,4); plot(t,v,’g-’);grid on;legend(’Vy[M/s]’);
subplot(3,2,5); plot(y,x,’r-’);grid on;legend(’Trayectoria’);

You might also like