title: Input array size error for a quadraple integration using nested integral2
body: <p>I need to perform a quadruple integration using <code>integral2</code> function in matlab. The code is below:</p>
  
  <pre><code>Rb = @(rho_1,phi_1) rho_1.*cos(phi_1);
  Sb = @(rho_2,phi_2) rho_2.*cos(phi_2);
  Tb = @(rho_1,phi_1,rho_2,phi_2) rho_1.*cos(phi_1)-rho_2.*cos(phi_2);
  InnerIntegrand = @(rho_1,phi_1,rho_2,phi_2) Rb(rho_1,phi_1).*Sb(rho_2,phi_2).*Tb(rho_1,phi_1,rho_2,phi_2);
  InnerIntegral = @(rho_1,phi_1) integral2(@(rho_2,phi_2) InnerIntegrand(rho_1,phi_1,rho_2,phi_2),0,3,0,2*pi);
  II = integral2(InnerIntegral,0,3,0,2*pi);
  </code></pre>
  
  <p>Where <code>InnerIntegrand (rho_1,phi_1,rho_2,phi_2)</code> is the integrand. The <code>InnerIntegral</code> evaluates over <code>rho_2</code> and <code>phi_2</code>, which is being called from an outer <code>integral2</code> (integration over <code>rho_1</code> and <code>phi_1</code>).</p>
  
  <p>I get an error:</p>
  
  <blockquote>
  <pre><code>Error using  .* 
  Matrix dimensions must agree.
  
  Error in @(rho_1,phi_1,rho_2,phi_2)Rb(rho_1,phi_1).*Sb(rho_2,phi_2).*Tb(rho_1,phi_1,rho_2,phi_2)
  
  
  Error in @(rho_2,phi_2)InnerIntegrand(rho_1,phi_1,rho_2,phi_2)
  
  
  Error in integral2Calc&gt;integral2t/tensor (line 238)
          Z1 = FUN(X(VTSTIDX),Y(VTSTIDX)); NFE = NFE + 1;
  </code></pre>
  </blockquote>
  
  <p>Is the error coming due to different array sizes of two <code>integral2</code> calls? What is the issue?</p>