% Con c=5
k=20;
c=5;
m=20;
x0=[1,0];
tfinal=40;
f=@(t,x)[x(2);(-c*x(2)-k*x(1))/20];
[t,x]=ode45(f,[0,tfinal],x0);
plot(t,x(:,1))
grid on
hold on
xlabel('tiempo'),ylabel('desplazamiento');
title('Amortiguamiento')

% Con c=40
k=20;
c=40;
m=20;
x0=[1,0];
tfinal=40;
f=@(t,x)[x(2);(-c*x(2)-k*x(1))/20];
[t,x]=ode45(f,[0,tfinal],x0);
plot(t,x(:,1))

% Con c=200
k=20;
c=200;
m=20;
x0=[1,0];
tfinal=40;
f=@(t,x)[x(2);(-c*x(2)-k*x(1))/20];
[t,x]=ode45(f,[0,tfinal],x0);
plot(t,x(:,1))
hold off