how can I solve a triple integral (x,y,z) with y not defined

4 ビュー (過去 30 日間)
Amber
Amber 2015 年 8 月 19 日
回答済み: Mike Hosea 2015 年 8 月 21 日
Hi I want to solve the following integral in matlab (this is from maple)
so i tried:
>> fun3 = @(z,x,y) 1
fun3 =
@(z,x,y)1
>> q = integral3(fun3,0,(y/0.348+13.95),-SQRT(3.85^2-y^2),SQRT(3.85^2-y^2),-3.85,3.85)
Undefined function or variable 'y'.
But it should be solved since you insert y in the integral......
Does some one know how to do this?
Thnx a lot!!
Amber

回答 (2 件)

Walter Roberson
Walter Roberson 2015 年 8 月 19 日
Use function handles to specify your bounds. See the description of ymin, ymax, zmin, zmax in http://www.mathworks.com/help/matlab/ref/integral3.html

Mike Hosea
Mike Hosea 2015 年 8 月 21 日
Your integrand will be evaluated at an array of points each time (not just with one x, y, and z!), so it must return an array of the same size as the input. It doesn't matter what you name the variables in this case, but y is the outermost integration, and so in general it must be the first input of the integrand function. I mention that in case you have an integrand someday that does not happen to be a constant. You can use functions for the bounds of the integration. The first pair of bounds must be scalars, the second pair of bounds can be functions of the first variable, and the third pair can be functions of the first two variables. In this case the innermost integration limits are functions only of the outermost variable value y, but in order for the software to work properly, we must provide a function that accepts both of the inputs that would be needed in general. The solution looks like this:
>> fun3 = @(y,x,z)ones(size(y));
>> integral3(fun3,-3.85,3.85,@(y)-sqrt(14.8225 - y.^2),@(y)sqrt(14.8225 - y.^2),0,@(y,x)2.873563218*y+13.94)
ans =
6.491336240832158e+02

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by