% 3 coupled masses global m b k l0 f_ext; m=2; b=0.5; k=50; l0 = 1.5; %simple 3-mass-spring-damper: %first conditions: figure f_ext = inline('0'); x0 = [l0, 5, 2*l0, 0, 3*l0, 0]; tspan = [0:0.01:10]; [t_3, x_3] = ode45('f_3springs', tspan, x0); plot(t_3, x_3(:,1:2:5)); %second conditions: figure f_ext = inline('sin(10*t)'); x0 = [l0, 0, 1.5*l0, 0, 2*l0, 0]; tspan = [0:0.01:10]; [t_4, x_4] = ode45('f_3springs', tspan, x0); plot(t_4, x_4(:,1:2:5));