double integral when using syms

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?

 채택된 답변

Walter Roberson
Walter Roberson 2012년 11월 25일

0 개 추천

Use int() for symbolic integration.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by