Another matlab question; triple integrals

In summary, the question is to evaluate a triple integral in spherical coordinates to find the mass density of a solid inside a cone and below a certain point. The integral is set up using p for rho, f for phi, and t for theta, and the bounds for p may need to be changed from 3 to 5sec(f) to 0 to 5sec(f). The attempt at a solution involves using the Matlab code "syms p f t" and integrating the function p^3*cos(f)*sin(t) over the given bounds. However, the resulting answer of 0 indicates a possible mistake in the bounds for p.
  • #1
lmannoia
32
0

Homework Statement


The question is to use MATLAB to evaluate a triple integral in spherical coordinates to find the mass density of the solid inside the cone z = (3x^2 + 3y^2)^.5 and below z = 5 where the mass density at (x,y,z) is equal to the z coordinate of the point.



Homework Equations


This is what I was doing. I'm using p for rho, f for phi, and t for theta to type it into matlab. I'm saying that p goes from 3 (or 0, I'm not sure...) to 5sec(f). Then f goes from 0 to pi/6 and t goes from 0 to 2pi. I'm integrating p^3*cos(f)*sin(t). I typed it in as:
syms p f t
int(int(int(cos(f)*sin(t)*p^3,p,3,5*sec(f)),f,0,pi/6),t,0,2*pi)
but MATLAB tells me that the answer is 0, which definitely isn't true, which means that I did something wrong somewhere! I know this might be hard to follow, but can someone spot my mistake?


The Attempt at a Solution

 
Physics news on Phys.org
  • #2
I think that the mistake I made was that I didn't change the bounds for p. Instead of going from 3 to 5sec(f), I think it should go from 0 to 5sec(f). I'm not sure though, so if anyone could confirm or deny this then that would be great!
 

1. What is a triple integral in Matlab?

A triple integral in Matlab calculates the volume under a three-dimensional surface. It is a numeric integration method that extends the concept of a single integral to three variables.

2. How do I write a triple integral in Matlab?

To write a triple integral in Matlab, use the triplequad function. It takes in the integrand, the limits of integration, and any additional parameters. Make sure to define the integrand as a function and use the appropriate syntax for the limits of integration.

3. What is the importance of triple integrals in Matlab?

Triple integrals are important in Matlab because they allow for the calculation of volumes and other properties of three-dimensional objects. They are also useful in solving differential equations and modeling physical systems.

4. Can I use symbolic variables in triple integrals in Matlab?

Yes, Matlab allows for the use of symbolic variables in triple integrals. This can be useful when dealing with complex functions or when the limits of integration are not constant values.

5. What is the difference between a double and a triple integral in Matlab?

The main difference between a double and a triple integral in Matlab is the number of variables involved. A double integral calculates the area under a two-dimensional surface, while a triple integral calculates the volume under a three-dimensional surface. Additionally, the syntax and functions used for each type of integral are different.

Similar threads

  • Calculus and Beyond Homework Help
Replies
3
Views
344
  • Calculus and Beyond Homework Help
Replies
3
Views
559
  • Calculus and Beyond Homework Help
Replies
4
Views
958
  • Calculus and Beyond Homework Help
Replies
3
Views
570
  • Calculus and Beyond Homework Help
Replies
3
Views
415
  • Calculus and Beyond Homework Help
Replies
2
Views
387
  • Calculus and Beyond Homework Help
Replies
3
Views
330
  • Calculus and Beyond Homework Help
Replies
5
Views
684
  • Calculus and Beyond Homework Help
Replies
9
Views
759
  • Calculus and Beyond Homework Help
Replies
1
Views
535
Back
Top