I am trying to compare the numerical results of a complex integral using Matlab's integral
.
In particular, I want to examine the accuracy of the results using
Is there a way to specify integration grid sizes (i.e.: number of equally spaced grid points) when using Matlab's integral
? Or should I find other alternatives?
Is there a way to specify integration grid sizes (i.e.: number of equally spaced grid points) when using MATLAB's
integral
?
Short answer: No.
The documentation says you can enter only:
q = integral(fun,xmin,xmax,Name,Value)
specifies additional options with one or more Name,Value pair arguments. For example, specify'WayPoints'
followed by a vector of real or complex numbers to indicate specific points for the integrator to use.
So, we scroll down a bit and read which name/value pairs are allowed and find:
'AbsTol'
, absolute error tolerance'RelTol'
, relative error tolerance'ArrayValued'
, array-valued function flag'Waypoints'
, integration waypointsMATLAB automatically optimises the integral and computes in numerically (of course), which ends for a given error, defined by 'AbsTol'
and 'RelTol'
. I'd just go with that.
If you do want to specify integration step size you can check what happens if you specify 'Waypoints'
to be [0:1/(100*T):T]
. I'd go with integrating it myself though, using a simple Riemann sum implementation.