how can I solve a triple integral (x,y,z) with y not defined
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (2개)
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
댓글 수: 0
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 General Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!