MATLAB: Double integral when using syms

double integralsyms

syms x y a
w(1)=(x-5)*(y-5)*(x-2.5)*(y-2.5)*(4/625);
w(2)=x*(x-5)*(y-2.5)*(y-5)*(-8/625);
w(3)=x*(x-2.5)*(y-2.5)*(y-5)*(4/625);
w(4)=(x-2.5)*(x-5)*y*(y-5)*(-8/625);
w(5)=x*(x-5)*y*(y-5)*(16/625);
w(6)=x*(x-2.5)*y*(y-5)*(-8/625);
w(7)=(x-2.5)*(x-5)*(y-2.5)*y*(4/625);
w(8)=x*(x-5)*(y-2.5)*y*(-8/625);
w(9)=x*(x-2.5)*(y-2.5)*y*(4/625);
for i=1:2
for j=1:2
m=diff(w(i),x);
n=diff(w(j),x);
o=diff(w(i),y);
p=diff(w(j),y);
a(x,y)=m.*n+o.*p;
fun=@(x,y)a(x,y)
k(i,j)=integral2(fun,0,5,0,5);
end
end
k
This is the code I am trying to run and I am getting an error "Input function must return 'double' or 'single' values. Found 'sym'." .. Any idea if this can be fixed? If not.. how do I evaluate the double integral?

Best Answer

Use int() for symbolic integration.