0

I am having trouble in evaluating the following double integral:

Clearly the oscillating nature of the cos function is causing these issues. As I increase f and g to larger numbers, matlab complains of the singularities and the integration being unsuccessful.

(3 - 2*cos(y).*cos(f*x+g*y) - cos((f-1)*x + g*y)) ./ (4 - 2*cos(y).*(cos(y) + cos(x))) dxdy

Over limits -pi to pi for x and -pi to pi for y.

I have been using:

quad2d(@(x,y)my_func(x,y,f,g),-pi,pi,-pi,pi)

Any help or ideas please???

4

1 回答 1

1

您首先需要检查这是一个数学问题还是一个编程问题。对于 0 和 130 的 f 和 g 输入,积分的边确实会趋于无穷大。因此,matlab 计算为无穷大也就不足为奇了,因为这确实是答案。

现在可以肯定的是,被积函数的边缘可能会趋于无穷大,而总积分也不会趋于无穷大,但是如果您在接近 pi 的极限时绘制结果,则总积分不会接近极限并且当您接近 pi 时继续上升。

z = zeros(1, 100);
dd = logspace(-8, -2, 100);
for i = 1 : 100
    d = dd(i);
    z(i) = quad2d(@(x,y)my_func(x,y,0,130),-pi+d,pi-d,-pi+d,pi-d);
end
plot(log10(dd), z)
于 2011-11-13T20:38:05.887 回答