Triple integral using integral3

13 次查看(过去 30 天)
DM
DM 2014-11-24
The following is a triple integral I am trying to compute using MATLAB, (please check link for clear illustration)
syms a
syms b
syms c
fabc= (a+b+c)*exp(a+b+c);
f=matlabFunction(fabc) % @(a,b,c)
cmin= @(a,b) b;
integral3(f,-inf,+inf,0,+inf,cmin,+inf)
Is the code correct? Please note that this is not my real function but I wrote an easy one for purpose of illustration...
Thanks

回答(1 个)

Roger Stafford
Roger Stafford 2014-11-24
The 'integral3' function performs numerical integration for which numerical values must be supplied. The form of your code looks correct for numerical integration except that the 'syms' lines should be removed.
If you want to perform symbolic triple integration, you will have to construct it using the 'int' function in triple form - that is, use it to integrate with respect to 'c' first, then use the answer to integrate with respect to 'b', and finally use that answer to integrate with respect to 'a'. You should be prepared for the possibility of exceedingly long answers with a symbolic triple integral. It may be advisable to apply the 'simplify' command in between the above steps to avoid needless complexity in your answer.
  2 个评论
DM
DM 2014-11-24
Thanks, but if I remove the syms line, MATLAB cannot recognize the variables a,b,c. Right?
Roger Stafford
Roger Stafford 2014-11-24
That's not necessarily true. To use 'integral3' what you must provide are the numerical values of all parameters that are used to define your integrand function and any numerical values involved in integration limits. In your case there are apparently none of this latter kind, but you may well have numerical parameters in your actual integrand function.
One further note: If you attempt to do symbolic integration instead, you should also be aware that 'int' can easily fail to find an explicit solution. It all depends on the nature of the integrand function and the integration limits. If you took integral calculus, you probably learned that there are many functions whose integrals don't show up in any integral tables, simply because they are unknown to mathematics.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by