{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

{[ snackBarMessage ]}