How do I integrate a very simple function with specified inputs?
Mostrar comentarios más antiguos
What I want to do is very simple, and so I am very frustrated. I simply want to integrate a function of multiple variables, i.e. a function with inputs (arrays) to be specified, say, a function involving a variable to be integrated over, x, and inputs, like a and b::
quad('a.*x - b',0,10)
I continue receiving this error message:
??? Error using ==> inline.subsref at 14
Not enough inputs to inline function.
My actual code is below
global a b
a = 1; b = 2;
integrand = inline('(x.^3-a*x-b)','a','b');
quad(integrand,-5,5)
I've tried everything I can think of, and making it as simple as possible, as you can tell. What am I doing wrong?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Function Creation en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!