how can I solve a triple integral (x,y,z) with y not defined
1 view (last 30 days)
Hi I want to solve the following integral in matlab (this is from maple)
so i tried:
>> 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!!
Mike Hosea on 21 Aug 2015
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)