Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How to supply a function elementwise to Integral2

1 vue (au cours des 30 derniers jours)
Kolibris
Kolibris le 21 Mar 2013
Clôturé : MATLAB Answer Bot le 20 Août 2021
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

Réponses (0)

Cette question est clôturée.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by