Triple integral (NO with @func)

4 views (last 30 days)
Diego Soler Polo
Diego Soler Polo on 10 Oct 2019
Answered: Steven Lord on 10 Oct 2019
I have a numerical function, F, depending on three variables, x,y,z, and I need to integrate it. The problem is that F does not have an explicit expression in terms of elementary functions, but rather, given (x,y,z), F(x,y,z) is calculated in a subroutine. How do I integrate numerically such a function?
Function handles don't work in this case, since I don't have a closed analytical expression for F.

Answers (1)

Steven Lord
Steven Lord on 10 Oct 2019
integral3 doesn't care whether or not you can write your integrand in a particular way. All it cares about is that it can call the function whose handle you pass in as the first input argument with three inputs that are the same size and returns an output of that same size containing values of your integrand for the corresponding elements of the inputs. It sounds like you already have such a function: "but rather, given (x,y,z), F(x,y,z) is calculated in a subroutine."
You could theoretically have your integrand function display "Perform an experiment with these parameters: ..." and ask the user to input the integrand value measured in those experiments. Most of the time the integral* functions will ask you to evaluate the function for too many parameter values for that to be feasible, but it is possible.

Categories

Find more on Numerical Integration and Differential Equations 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!