"Not enough input arguments" error when integrating a function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi guys,
I am trying to numerically integrate a function and keep receiving the error "Not enough input arguments."
My code:
integral(fun,0,1)
while fun.m reads:
function [ y ] = fun( x ) y = x*2 + 1; end
What am I missing here? Thanks in advance!
0 comentarios
Respuestas (2)
Kye Taylor
el 19 de Mzo. de 2013
You need to use a function handle... try
integral(@fun,0,1)
0 comentarios
Fabian
el 19 de Mzo. de 2013
1 comentario
Kye Taylor
el 19 de Mzo. de 2013
Yeah... pass those variables as input to the function (best practice).
Also, please accept answers that you find helpful. (My first one.)
Ver también
Categorías
Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!