Code covered by the BSD License  

Highlights from
Classical_Mechanics_with_Matlab_applications_JEH.zip

from Classical_Mechanics_with_Matlab_applications_JEH.zip by Javier Hasbun
Applications from the text: Classical Mechanics with Matlab applications by Javier E Hasbun, Jones &

simpu=simp(f,inc)
%simp.m
function simpu=simp(f,inc)   
%Simpson's rule for numerical integration
%f is an odd array of evaluated functions in steps inc
ip=length(f);       %must be an odd number
s1=sum(f(2:2:ip-1));%sums all even terms
s2=sum(f(3:2:ip-2));%sums all odd term does not include f(1) and f(ip)
simpu=(4.*s1+2.*s2+f(1)+f(ip))*inc/3.0;%finally add f(1) and f(ip)

Contact us at files@mathworks.com