Path: news.mathworks.com!not-for-mail From: "David Edson" <tojadeb@example.com> Newsgroups: comp.soft-sys.matlab Subject: Re: calculating the volume of a given shape Date: Mon, 20 Apr 2009 07:56:02 +0000 (UTC) Organization: KU LEUVEN Lines: 43 Message-ID: <gsh9qi$lmh$1@fred.mathworks.com> References: <gs4q8u$kg1$1@fred.mathworks.com> <gs6hop$mfh$1@fred.mathworks.com> Reply-To: "David Edson" <tojadeb@example.com> NNTP-Posting-Host: webapp-02-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1240214162 22225 172.30.248.37 (20 Apr 2009 07:56:02 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Mon, 20 Apr 2009 07:56:02 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1067486 Xref: news.mathworks.com comp.soft-sys.matlab:533988 Thank you Roger, I can calculate the integral using summation by taking small t intervals. I have one question though, What would be therCross sections orthogonal to the y-axis. The aim is still to calculate the volume. If the shape is defined as follows. I introduced a sin(beta) in the y direction. x=rx.*cos(theta).*cos(beta); y=ry.*(sin(theta)+ (abs(sin(k1*beta))+ 2.^(k2.*theta)- 2.^(k3*theta))); z=rz.*cos(theta).*sin(beta); Thanks in advance "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gs6hop$mfh$1@fred.mathworks.com>... > "David Edson" <tojadeb@example.com> wrote in message <gs4q8u$kg1$1@fred.mathworks.com>... > > I have a shape defined by the following formula? > > -pi/2<theta<pi/2; 0<beta<2pi > > > > x=rx.*cos(theta).*cos(beta); > > y=ry.*sin(theta)+(2.^((-2*theta))+2.^((0.5*theta))); > > z=rz.*cos(theta).*sin(beta); > > > > how could I calculate the volume? > > There is a way to obtain a precise answer for your volume using just a single integration, David. Its validity depends, as John has pointed out, on your surface not intersecting itself and that depends on the value of ry. You can tell if that happens by plotting cos(theta) against y(theta) as theta varies from -pi/2 to +pi/2 to see if the curve crosses itself. > > Cross sections orthogonal to the y-axis yield ellipses of area pi*rx*rz*cos(theta)^2, so you just need to integrate this area along the y-axis. In some places the total cross section actually consists of an ellipse with a similar ellipse of smaller size cut out of its center. However, if you express your integral in terms of the parameter theta, this will automatically handle that situation (again provided the surface doesn't intersect itself.) > > If we abbreviate theta with simply t, you can express the volume as the definite integral of the function > > f(t) = pi*rx*rz*cos(t)^2 * dy/dt > > taken with respect to t, from t equals -pi/2 to +pi/2. > > As it turns out, this integral can be evaluated in terms of elementary functions, so numerical methods are not really necessary. This integrand has three parts: the first part is a constant times cos(t)^3, and the second and third parts are both constants times cos(t)^2*exp(k*t) for two appropriate values of k. Each of these is of a form that can be evaluated using either integral tables or matlab's 'int' function in the Symbolic Toolbox. > > The above is the way I would tackle the problem, but I won't spoil things for you by carrying this any further (and anyway it's my bedtime.) > > Roger Stafford