title: MATLAB error while trying to solve triple integral equation involvong one double integral
body: <p>I am trying to solve a system of three integral equations to obtain three factors. The equations look as follows:</p>
  
  <p><img src="https://i.stack.imgur.com/aRra3m.png" alt="System of three integral equations"></p>
  
  <p>These equations need to be solved to obtain a1, a2 &amp; a3. If it were not for the double integral with variable higher limit in the third term, it would have been relatively easy to solve this system using MATLAB. However, as soon as this double integral is entered into the MATLAB code I see an error message.
  Here's my code:</p>
  
  <pre><code>function solveIntegralForB
  clc
  clear all
  
  % Extruder screw specifications
  
  AB0=[1 1 1]
  %optz1 = optimset('TolX',1e-32);
  bfound = fsolve(@fminsearch,AB0)%,optz1)
  
        function output = fminsearch(AB)
            HH=1;
  
  
            yS1 = 0;
            yE1 = HH;
            yS2 = 0;
            yE2 = HH;
            zS3=0;
            zE3= @ (y) y;
            yS3 = 0;
            yE3 = HH;
  
            L1=50;
            L2=10;
            L3=0;
            %L=L';
  
            Inty1=integral(@Func1,yS1,yE1);
            Inty2=integral(@Func2,yS2,yE2);
            Inty3=integral2(@Func3,yS3,yE3,zS3,@ (y) y);
            %output = (L1 - Inty1)^2+(L2 - Inty2)^2;
            output(1) = (L1 - Inty1)^2;
            output(2) = (L2 - Inty2)^2;
            output(3) = (L3 - Inty3)^2;
            % factors in Eq.17 from reference
            % AB(1)=A, AB(2)=A1, AB(3)=B1
  
            sOut=size(output);
            function fy1 = Func1(y)
                BB=1;
                fy0=sqrt((AB(1)*y+AB(2)).^2+(BB*y+AB(3)).^2); 
                fyy=((1+fy0).^2)./(1-fy0); % F(y) in Eq.17  
                fAy=(AB(1)*y+AB(2))./(1-fy0);   
                fy1=fyy.*fAy;
            end
  
            function fy2 = Func2(y)
                BB=1;
                fy0=sqrt((AB(1)*y+AB(2)).^2+(BB*y+AB(3)).^2); 
                fyy=((1+fy0).^2)./(1-fy0); % F(y) in Eq.17  
                fBy=(BB*y+AB(3))./(1-fy0);   
                fy2=fyy.*fBy;                     
            end
  
            function fy3 = Func3(y)
                BB=1;
                fy0=sqrt((AB(1)*y+AB(2)).^2+(BB*y+AB(3)).^2); 
                fyy=((1+fy0).^2)./(1-fy0); % F(y) in Eq.17  
                fAy=(AB(1)*y+AB(2))./(1-fy0);   
                fy3=fyy.*fAy;                  
            end
  
  
        end
  
  end
  </code></pre>
  
  <p>And here is the error message:</p>
  
  <pre><code>Error using LeonExtruder/fminsearch/Func3
  Too many input arguments.
  
  Error in integral2Calc&gt;integral2t/tensor (line 228)
          Z = FUN(X,Y);  NFE = NFE + 1;
  
  Error in integral2Calc&gt;integral2t (line 55)
  [Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
  
  Error in integral2Calc (line 9)
      [q,errbnd] =
      integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
  
  Error in integral2 (line 106)
      Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);
  
  Error in LeonExtruder/fminsearch (line 34)
            Inty3=integral2(@Func3,yS3,yE3,zS3,@ (y) y);
  
  Error in fsolve (line 230)
              fuser = feval(funfcn{3},x,varargin{:});
  
  Error in LeonExtruder (line 12)
  bfound = fsolve(@fminsearch,AB0)%,optz1)
  
  Caused by:
      Failure in initial objective function evaluation. FSOLVE
      cannot continue.
  </code></pre>