matlab guide for Calculating 6 dimensional numerical integral Dosen't work
Show older comments
How should I calculate 6 dimentinal numerical integration in matlab? my first try failed as below code :
I Know this problem can be solved symbolicly. but i need to calculate integral of a very complicated 6-D integral. which its integrand has product term of bessel fuctions, sin functions and exponential functions. and this simple example will guide me to solve that question.
My code in based on guide for 4-D numercal integration in https://nl.mathworks.com/help/matlab/ref/integral3.html which matlab stated : "The integral quadrature functions in MATLAB® directly support 1-D, 2-D, and 3-D integrations. However, to solve 4-D and higher order integrals, you need to nest calls to the solvers."
but matlab guide dosen't work ??!!
f = @(x,y,u,t,v,r) x*y*u*t*v*r ;
xmin = 0 ;
xmax = 1 ;
ymin = 0 ;
ymax = @(x) x;
umin = 0 ;
umax = @(x,y) x+y;
tmin = 0;
tmax = @(x,y,u) x+y+u;
vmin = 0;
vmax = @(x,y,u,t) x+y+u+t;
rmin = 0;
rmax = @(x,y,u,t,v) x+y+u+t+v;
Q1 = @(x,y,u) integral3(@(t,v,r) f(x,y,u,t,v,r) ,tmin,tmax,vmin,vmax,rmin,rmax)
Q2 = integral3(@(x,y,u) Q1(x,y,u) ,xmin,xmax,ymin,ymax,umin,umax)
5 Comments
Dyuman Joshi
on 19 Mar 2024
Edited: Dyuman Joshi
on 19 Mar 2024
Otherwise, you need to use symbolic integration (Note - requires Symbolic Math Toolbox).
Mehdi Morshedi
on 19 Mar 2024
Mehdi Morshedi
on 19 Mar 2024
Dyuman Joshi
on 19 Mar 2024
As I mentioned above - When using integral3, you need to provide atleast 1 set of limits as numbers.
And, the example you linked uses numerical limits, not function handles.
What exactly are you trying to do? It would be helpful if you could specify the objective and provide more information.
Mehdi Morshedi
on 19 Mar 2024
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!