If you are using the simpsons
function in MATLAB for numerical integration and you get the "repeated Simpson's rule" error, that means that the function was unable to achieve the desired level of accuracy and needs to use a finer grid (i.e., more intervals) to compute the integral.
To fix this error, you can either increase the number of intervals manually (by increasing the n
input argument to simpsons
), or you can use a different integration method altogether (such as the integral
function in MATLAB).
Here's an example of how to adjust the number of intervals in the simpsons
function:
main.m454 chars18 lines
This code will keep increasing the number of intervals by 10 each time until the estimated error is below the desired tolerance.
gistlibby LogSnag