How to perform 4D integral in matlab ?

27 vues (au cours des 30 derniers jours)
Yu-Chen
Yu-Chen le 31 Mai 2013
I want to calculate the integral of a bidirectional reflectance distribution function(a function with 2 direction parameters both represent by a pair of theta and phi, so it's a 4D function). Since the function is usually not easy to factor out as multiplication of lower dimensional function it's hard to use command such as "integral" or "integral2", any suggestion about this issue ?

Réponse acceptée

Mike Hosea
Mike Hosea le 1 Juin 2013
The easiest way to integrate f(x,y,z,w) from a <= x <= b, c <= y <= d, e <= z <= g, and h <= w <= i is
Q = integral(@(x)integral3(@(y,z,w)f(x,y,z,w),c,d,e,g,h,i),a,b,'ArrayValued',true);
if the limits are functions of the preceding variables, i.e.:
c(x), d(x), e(x,y), g(x,y), h(x,y,z), i(x,y,z)
you will have to fix x in them as we did for the integrand:
Q = integral(@(x)integral3(@(y,z,w)f(x,y,z,w),c(x),d(x),@(y)e(x,y),@(y)g(x,y),@(y,z)h(x,y,z),@(y,z)i(x,y,z)),a,b,'ArrayValued',true);
The other, and perhaps faster way in some cases, would be to do an integral2(integral2(...)...) nesting, but this requires a bit of work to set up because of the vectorization that integral2 requires of the integrand.

Plus de réponses (0)

Catégories

En savoir plus sur Install Products dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by