Integration using a vector as function parameter
Mostrar comentarios más antiguos
I'm a recent joinee to the MATLAB community and have what I think is fairly simple question but can't seem to find the answer so maybe its less simple than I think.
I have a vector containing a string of data and want to use that data to provide a single parameter in a function for definite integration.
Ultimately I want to write a function that will return a vector that contains the definite integrals of this function using the previous vector as a parameter of the function.
i.e.
N=[1:4];
Crush = @(x,n) x.^n;
M = quad(crush(x,N),0,2);
I know that this doesn't work at least in this form because quad will not accept a function with argument, but hopefully my intention is clear. I was wondering if there is a way to do this without resorting to a complex for/while loop. I suspect that it can be done by nesting functions and I'm just missing something very simple. I'm using x^n as an example for the function.
Thanks for any help,
Paul
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!