0
我想解決一個雙積分,我正在解決內部以及與quadgk函數外部積分。如何在matlab中使用quadgk函數作爲函數句柄?
% The integrand is of course a function of both x and y
integrand = @(x,y) (phi(j,y,X) - phi(j,x,X))*(phi(i,y,X) - phi(i,x,X))/abs(y-x)^(2*s+1)
% The inner integral is a function of x, and integrates over y
inner = @(x) quadgk(@(y)integrand(x,y), x-lambda, x+lambda)
% The inner integral is integrated over x to yield the value of the double integral
dblIntegral = quadgk(inner, -(1+lambda), 1+lambda)
和我得到這個以下錯誤:
integrand = @(x,y)(phi(j,y,X)-phi(j,x,X))*(phi(i,y,X)-phi(i,x,X))/abs(y-x)^(2*s+1)
inner = @(x)quadgk(@(y)integrand(x,y),x-lambda,x+lambda)
??? Error using ==> quadgk at 108
A and B must be scalar floats.
Error in ==> @(x)quadgk(@(y)integrand(x,y),x-lambda,x+lambda)
Error in ==> quadgk>evalFun at 344
fx = FUN(x);
Error in ==> quadgk>f1 at 362
[y,too_close] = evalFun(tt);
Error in ==> quadgk>vadapt at 258
[fx,too_close] = f(x);
Error in ==> quadgk at 197
[q,errbnd] = vadapt(@f1,interval);
Error in ==> frational_laplacian at 29
dblIntegral = quadgk(inner, -(1+lambda), 1+lambda)