How to compute Double Integral of highly oscillating function?

9 visualizaciones (últimos 30 días)
Junxian
Junxian el 21 de Nov. de 2013
Respondida: Mike Hosea el 21 de Nov. de 2013
I encountered a problem of computing double integral of highly oscillating function such as:
integrate sin(a*(x-y)) where a is constant (i.e. 10) x and y are variables, the lower and upper bound for x and y are the same from 0 to 100
I tried the built-in function 'integral2', which gives me large error.
Can anyone please share some MATLAB scripts or ideas that accurately compute the above quadrature?
Thanks in advance.

Respuestas (1)

Mike Hosea
Mike Hosea el 21 de Nov. de 2013
So I assume you saw this:
>> a = 10;
>> f = @(x,y)sin(a*(x-y))
f =
@(x,y)sin(a*(x-y))
>> integral2(f,0,100,0,100,'method','tiled')
Warning: Reached the maximum number of function evaluations (10000). The
result fails the global error test.
> In funfun\private\integral2Calc>integral2t at 129
In funfun\private\integral2Calc at 9
In integral2 at 106
ans =
-2.655339166047913
The warning just tells you that the integration was never completed, so the answer is not really an answer. You could divide the region into smaller regions, but instead try the iterated method.
>> integral2(f,0,100,0,100,'method','iterated')
ans =
-3.013333361769528e-12

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by