integral command with function handle

1 visualización (últimos 30 días)
Ali Kiral
Ali Kiral el 11 de Dic. de 2022
Comentada: Ali Kiral el 11 de Dic. de 2022
Why do I get an error message with the following piece of script? Everything seems OK (I use R2014a by the way)
func=@(x) exp(x^2)/(x^0.5)
func =
@(x)exp(x^2)/(x^0.5)
>> integral(func,0,1)
Error using integral
Too many input arguments.
>>

Respuesta aceptada

VBBV
VBBV el 11 de Dic. de 2022
Editada: VBBV el 11 de Dic. de 2022
May be you have function defined with a name integral. Check the working folder where you might have such function and which takes few input arguments (<=2)
func=@(x) exp(x.^2)./(x.^0.5)
func = function_handle with value:
@(x)exp(x.^2)./(x.^0.5)
integral(func,0,1)
ans = 2.5426
  1 comentario
Ali Kiral
Ali Kiral el 11 de Dic. de 2022
You're right, I realized I had a function m-file (with a name integral) lurking in the working folder. It accepted one input. Now it's history:)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by