trap - y=(h/2)*(feval(fn,a)+feval(fn,b)+2*y); end

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

View Full Document Right Arrow Icon
function y = trap(fn,a,b,h) n= (b-a)/h; x=a+[1:n-1]*h; y=sum(feval(fn,x));
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: y=(h/2)*(feval(fn,a)+feval(fn,b)+2*y); end...
View Full Document

This note was uploaded on 09/15/2011 for the course EE 150 at USC.

Ask a homework question - tutors are online