Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to supply a function elementwise to Integral2

1 次查看(过去 30 天)
Hi guys,
I want to evaluate a double integral of the form int_{-inf}^a int_{-inf}^b sum_{i,j}^K a_i*a_j*x^i*y^j*exp(-x^2 - y^2 + x*y)dx dy where a_i and a_j are constants. Since the integral is linear, I can change summation and integration, but in this case I have to evaluate K^2 integrals and it takes too long. In that case I do the following:
for i = 1:K
for j = 1:K
fun = @(x,y) x.^i.*y.^j.*exp(-2.*(x.^2 + y.^2 - 2.*x.*y))
part(i,j) = alpha(i)*alpha(j)*integral2(fun,-inf,a,-inf,b)
end
end
It takes too long, so I want to evaluate only one integral, but I don't know how to factorize sum_{i,j}^K a_i*a_j*x^i*y^j*exp(-x^2 - y^2 + x*y), namely, how to supply it to integral2. | would be very grateful for any help.
Kind regards, Renata

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by