ejercicio 3

Contents

movimiento del muelle

function ejercicio3
[t1, xx1]=ode45(@muelle, [0,40], [1,0],[ ], 5);
plot(t1,xx1(:,1))

hold on

[t2, xx2]=ode45(@muelle, [0,40], [1,0],[ ], 40);
plot(t2,xx2(:,1))

[t3, xx3]=ode45(@muelle, [0,40], [1,0],[ ], 200);
plot(t3,xx3(:,1))
end

funcion muelle

function x=muelle(t,x,c)
x=[x(2); (-c*x(2)-20*x(1))/20];
end