How to supply a function elementwise to Integral2
Info
This question is closed. Reopen it to edit or answer.
Show older comments
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
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!