TrapInteg - npts = nstrips+1; h=(b-a)/nstrips; x=[a:h:b]';...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function I=TrapInteg(func,a,b,nstrips) npts = 2*nstrips+1; h=(b-a)/nstrips; x=[a:h:b]'; f=func(x); I = (h/2)*(f(1,1)+2*sum(f(2:npts-1,1)+f(npts,1)); function I=TrapInteg(func,a,b,nstrips)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: npts = nstrips+1; h=(b-a)/nstrips; x=[a:h:b]'; f=func(x); I = (h/3)*(f(1,1)+4*sum(f(2:2:npts-1,1). ..... 2*sum(f(2:npts-1,1)+f(npts,1));...
View Full Document

This note was uploaded on 09/27/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

Ask a homework question - tutors are online