On Wednesday, October 1, 2014 10:30:49 AM UTC-4, Tim Holy wrote: > > Since Matlab doesn't distinguish between arrays and scalars, it's a > perfectly > reasonable mistake. I also would naively have expected it to return a > scalar, > but I've never used quadgk so I really have no idea.
quadgk returns the same type as your integrand, so it returns a scalar for scalar integral for scalar integrands. Here, apparently your integrand function is returning a 1x1 matrix, hence the integral result is of the same type. Probably it's better (= cleaner, faster) to change your integrand to return a scalar result.