% Integrate a spring-mass system

X0 = [1;0];
T = linspace(0,100,1000);
sol = lsode("spring", X0, T);

% Time series plot
plot(sol);

% Phase diagram - velocity as function of position
title "The phase space diagram of a damped spring-mass system"
xlabel "Position"
ylabel "Velocity"
plot(sol(:,1),sol(:,2));
