function [xdot,xinit,option] = alpha( t, x, flag) % Alpha: second order response global stim switch flag case '' s = interp1(stim(:,1),stim(:,2),t); % linear interpolation a = 1; xdot = [ s - a*x(1); x(1) - a*x(2)]; case 'init' xdot = [stim(1,1) stim(end,1)]; % time span xinit = [0;0]; % initial condition option = odeset('MaxStep',0.1); % option: not to skip the stimulus end