How to define variables using triple integrals
7 views (last 30 days)
Show older comments
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!
0 Comments
Answers (1)
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
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.
See Also
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!