How to compute Double Integral of highly oscillating function?
6 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Mike Hosea
2013-11-21
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!