I am trying to numerically evaluate a double integral. The specific integral is too complicated, but it is not relevant here, I only want the main idea.
Suppose I have:
x=1;
y=1;
fun = @(theta,phi) (x.*sin(theta) + y.*cos(phi));
result = integral2(fun,0,pi,0,2*pi)
This gives a single value. Assume I'd like to do this for a range of values for X and Y. Ideally, I'd like to have x,y as vectors:
x=1:10;
y=1:10;
Matlab gives (Error using .* Matrix dimensions must agree.)
What is the solution? (Ideally, I do not want to use for loop).