Search code examples
matlabintegralfunction-handle

MATLAB - Integral 2 - First input argument must be a function handle


I need to use the integral2() function with syntax: q = integral2(fun, xmin , xmax, ymin , ymax).

I've tried the commands:

Alphai(: , 1) = {@(x,y) Alpha(1,1)+Alpha(2,1)*x+Alpha(3,1)*y};
Alphai(: , 2) = {@(x,y) Alpha(1,2)+Alpha(2,2)*x+Alpha(3,2)*y};
Alphai(: , 3) = {@(x,y) Alpha(1,3)+Alpha(2,3)*x+Alpha(3,3)*y};
for ind = 1:3
    temp0 = integral2(Alphai(: , ind), xmin , xmax , ymin , ymax);
end

(already defined xmin, xmax, ymin, ymax)

But I got an error:

First input argument must be a function handle

Can someone help and explain me what am I doing wrong?


Solution

  • Try this:

    for ind = 1:3
        temp0 = integral2(Alphai{: , ind}, xmin , xmax , ymin , ymax);
    end