% Programming and Numerical Methods
% MSc in Computational and Applied Physics

% Code 10:  Composite midpoint formula
% A. Meseguer (2007)

  function integ = mpcf(a,b,m,myfun) 
 
  H = (b-a)/m ; x = a + (2*[0:m-1]' + 1)*H/2 ;
  f = feval(myfun,x) ;
  integ = H*sum(f) ;


