Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How to evaluate the following integral in Matlab? $$\int_a^b{\int_0^{2\pi}{\sqrt{y^2(\cos^2{\theta}-1)+1}}\,\mathrm{d}\theta}\,\mathrm{d}y$$

$a$ and $b$ are vectors with values.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Use the dblquad function.

dblquad(@(t,y)sqrt(y.^2*(cos(t).^2-1)+1), 0, 2*pi, a, b)
share|improve this answer
    
dblquad() does only accept scalar vectors. So, I will have to inclose it in a for loop. –  Osama Gamal Jul 2 '11 at 13:03

I can't tell what evaluating an integral with vector limits means, unless you're doing things componentwise. In that case, you're asking how to evaluate

$$\int_a^b{\int_0^{2\pi}{\sqrt{1-y^2\sin^2{\theta}}}\,\mathrm{d}\theta}\,\mathrm{d}y$$

which simplifies by symmetry to

$$4\int_a^b{\int_0^{\pi/2}{\sqrt{1-y^2\sin^2{\theta}}}\,\mathrm{d}\theta}\,\mathrm{d}y$$

and the complete elliptic integral of the second kind pops up:

$$4\int_a^b{E(y^2)}\,\mathrm{d}y$$

where $E(m)$ is the complete elliptic integral of the second kind with parameter $m$, as implemented in MATLAB.

You can then use the usual quadrature routines (e.g. quad()) like so: construct the appropriate function

function e = osama(x)
[k, e] = ellipke(x^2);

and then feed the function handle to the quadrature routine: 4.*quad(@osama,a,b).

As for a closed form, it involves hypergeometric functions, so I doubt such a thing would be of any use to you.

share|improve this answer
    
That's pretty useful, thanks :) –  Osama Gamal Jun 30 '11 at 9:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.