0

I'm trying to use MATLAB's integral function on MATLAB R2012b.

The associated function documentation has a clear example

% create an anonymous function
fun = @(x) exp(-x.^2).*log(x).^2;

% integrate
q = integral(fun,0,Inf)

But when I do this I get;

Error using subsindex
Function 'subsindex' is not defined for values of class 'function_handle'.

I've seen this appear a view times in random places online, but never found a satisfying answer describing what's going on. Any ideas of how to stop this or what could be causing it?

Alex
  • 2,000
  • 4
  • 23
  • 41

1 Answers1

1

According to this answer, you should try checking if you have another integral function in a different directory on the path. To do that, type which integral in your Command Window. If a different integral exists, remove the integral function which is not part of the Matlab distribution from the path.

Community
  • 1
  • 1
Etienne Pellegrini
  • 738
  • 1
  • 5
  • 11
  • Bingo bango - integral was defined as a variable in a function being called elsewhere. – Alex Aug 28 '14 at 20:30