title: Nested integral within integral2 in matlab
body: <p>I'm attempting to take the double integral (using integral2) of a function that is defined by an integral.</p>
  
  <p><a href="http://i.imgur.com/gIUsLSw.jpg" rel="nofollow">http://i.imgur.com/gIUsLSw.jpg</a></p>
  
  <p>Here is what I am currently attempting:</p>
  
  <pre><code>t=linspace(0,1,50);
  fun_1= @(v) exp(.071*v)
  fun  = @(x,y) exp(0.14*0.00607*integral(@(u)fun_1(u),0,x)).*exp(-(x-y).^2).*exp(0.14*0.00607*integral(@(u)fun_1(u),0,x));
  for i=2:length(t)
      for j=i:length(t)
      A(i,j)=integral2(fun,t(i-1),t(i),t(j-1),t(j));
      end
  end
  </code></pre>
  
  <p>I'm receiving the error </p>
  
  <blockquote>
    <p>Error using integral (line 86) A and B must be floating point scalars.</p>
  </blockquote>
  
  <p>Can anyone provide any information on how to fix this problem.</p>