Ejercicio 3

Contents

Resolveremos mediante ODE RK el movimiento de un muelle

function movmuelle
[t0, xx0]=ode45(@muelle, [0,40], [1,0],[ ], 5);
plot(t0,xx0(:,1))

hold on

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

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

funcion muelle

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