Skip to content

Commit

Permalink
Create compositesimpson13.m
Browse files Browse the repository at this point in the history
  • Loading branch information
kwyip authored Jul 2, 2017
1 parent 76c1b28 commit 446e97c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compositesimpson13.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function csimpson = compositesimpson13(f,a,b,n)
h=(b-a)/n;
xi=a:h:b;
csimpson = h/3*(f(xi(1))+2*sum(f(xi(3:2:end-2)))+4*sum(f(xi(2:2:end)))+f(xi(end)));

0 comments on commit 446e97c

Please sign in to comment.