% Example 16.6c (Physics 330) % eventrhs.m, Matlab function to compute [du(1)/dt;du(2)/dt] function rhs=eventrhs(t,u,omega) % right-hand side for the simple harmonic oscillator % make sure rhs is a column vector rhs(1,1)=u(2); rhs(2,1)=-omega^2*u(1);