Here's an example of how to create a function for Simpson's 1/3 rule in Matlab:
621 chars28 linesTo use this function, you would define your integrand function f, lower and upper limits of integration a, b, and the number of intervals n, and then call the simpson function, like this:
232 chars7 linesThis would output an approximate value of the integral of 0.7181.
gistlibby LogSnag