Why this error using integral function?

4 visualizaciones (últimos 30 días)
Ove Gustafsson
Ove Gustafsson el 10 de Mzo. de 2015
Comentada: Ove Gustafsson el 11 de Mzo. de 2015
What is wrong?
>> T = @(x) 1/x; >> Q=integral(T,1,1000); Undefined function 'minus' for input arguments of type 'function_handle'.
Error in integral (line 4) N=(hmax-hmin)/0.0001;

Respuesta aceptada

Michael Haderlein
Michael Haderlein el 10 de Mzo. de 2015
Fun thing is I get a different error message:
Error using /
Matrix dimensions must agree.
Anyway, if you change your definition of T to
T=@(x) 1./x;
(note the dot!), it should work.
  1 comentario
Ove Gustafsson
Ove Gustafsson el 11 de Mzo. de 2015
Thank you for the answer. You are right it has to be 1./x since the function has to handle arrays, but the main problem was quit different. Since I downloaded a set of MatLab-files within an application that used the name integral for a function of there own, integral.m, and the path was set so MatLab was looking there first. the new integral.m didn't work in the same way as the original integral.m of MatLab. Sorry for troubling you with a trivial problem. Best regard

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Downloads en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by