% This is the suitcase problem from Suherman, et al., Effect of Human % Response Time on Rocking Instability of a Two-Wheeled Suitcase, % J. of Sound and Vibration, Vol. 207 (5), 1997, 617-625. Event % location is used to find when the wheels impact the ground and % when the suitcase has fallen over. The parameter values are those % used to generate Figure 3a in the reference. state = +1; opts = ddeset('RelTol',1e-5,'AbsTol',1e-5,'Events','exam8e'); sol = dde23('exam8f',0.1,[0; 0],[0 12],opts,state); % Reference values for event locations: ref = [4.516757065, 9.751053145, 11.670393497]; fprintf('\nKind of Event: dde23 reference\n'); event = 0; while sol.x(end) < 12 event = event + 1; if sol.ie(end) == 1 fprintf('A wheel hit the ground. %10.4f %10.6f\n',... sol.x(end),ref(event)); state = - state; opts = ddeset(opts,'InitialY',[ 0; 0.913*sol.y(2,end)]); sol = dde23('exam8f',0.1,sol,[sol.x(end) 12],opts,state); else fprintf('The suitcase fell over. %10.4f %10.6f\n',... sol.x(end),ref(event)); break; end end plot(sol.y(1,:),sol.y(2,:)) title('Figure 8. Suitcase problem.') xlabel('\theta(t)') ylabel('\theta''(t)')