What is 'integration over a _discrete_ interval' ?
Best wishes
Torsten.
If you mean you want to integrate a function numerically over a finite
interval, use QUADGK, QUAD, or QUADL.
If you mean you want to integrate a function numerically over a 2D or 3D
region look at QUAD2D, DBLQUAD, or TRIPLEQUAD.
If you want to integrate a function symbolically and have Symbolic Math
Toolbox available, use INT.
If you just have data representing the values of a function at certain
locations in your interval, use TRAPZ.
If you mean something else, please clarify what you're looking to do.
--
Steve Lord
sl...@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
Thanks!
Further to this...
How would it be possible to compute a double integral with a variable lower limit on the inner integral but with infinite upper limits, given that quad2d does not accept infinite limits?
Specifically, the integrand is a function of a and h;
y = @(a,h) a*lognpdf(a,mu_a,sigma_a)*lognpdf(h,mu_h,sigma_h)
and the inner limits are f(h) and inf, where f is some (simple linear) function of h, and the outer limits are (b,inf). So after specifying f(h), I *would like* to write
quad2d(@(a,h) a.*lognpdf(a,mu_a,sigma_a).*lognpdf(h,mu_h,sigma_h),f(h),inf,b,inf)
but cannot because the limits must be finite.
The alternative method I've tried is to use the "int" function to do the double integral after having declared a and h as symbolic variables. (The lognormal distributions must be written out explicitly because MATLAB does not appear to accept symbolic inputs to the distribution functions.) But MATLAB cannot find an explicit integral and neither can it convert the result through the "double" function.
Thanks for any help.