How to define variables using triple integrals

7 views (last 30 days)
Ive been at this for to long. I need to calculate the triple integral of 1 dz dy dx..
fun = @ (z,y,x) 1
but not I do not know how to type in the limits of integration.
The first one is from 0 to -3/2x-y+3
I put xmin = 0
xmax = -3/2.*x.-y.+3
I get an undefined matlab operator where the period is to the right of x. I've tried every combination and can't seem to be able to type in a simple equation.
If anyone can help me to where matlab will take the upper bound limit of integration that would help a lot!

Answers (1)

Roger Stafford
Roger Stafford on 28 Mar 2015
Edited: Roger Stafford on 28 Mar 2015
See Mathworks' documentation site:
http://www.mathworks.com/help/matlab/ref/integral3.html
As you can see, if you have variable limits of integration in 'integral3', these must be defined in terms of functions, either anonymous functions or other kinds of functions, and not an expression such as you used here.
Also the dots following x and y in your expression are definitely not valid in any case. What were you trying to accomplish there?
  2 Comments
randolph goldsmith
randolph goldsmith on 30 Mar 2015
So the function as said above is just 1 dz dy dx. What I am trying to accomplish is how to write zmax which would be the upper bound which I found to be -3/2x-y+3.
Then then you would integrate with respect to y which z= 0 so you would solve for y and get 3/2x+3.. which would be my ymax.
I am just trying to put those limits of integration into matlab so it would solve the triple integral and I saw periods after the x's and y's in the examples so I just followed thinking that was the syntax to input y's and x's.
What I want to find is what is the right syntax to input those two limits of integration where 0 to 2 is easy.
Roger Stafford
Roger Stafford on 2 Apr 2015
You haven't made it clear what three-dimensional space you are integrating over. In particular you haven't defined your lower integration limits. I have guessed from your remarks that it is over the following tetrahedron:
xmin = 0;
xmax = 3;
ymin = 0;
ymax = @(x)-3/2*x+3;
zmin = 0;
zmax = @(x,y)-3/2-y+3;
The desired integral would then be:
I = integral3(@(x,y,z)1,xmin,xmax,ymin,ymax,zmin,zmax);
If this is the intended region of integration, you could of course have done the integration mentally and gotten
1/6*3*3*2 = 3 (1/6*base*height)
as the answer without ever bothering to use matlab.

Sign in to comment.

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!