I'm trying to work with integrals that are functions of one of their limits:
phi = @(x) quad(@(L) besseli(1, (1+L)/(1-L)), 0, x);
What I'm trying to do is evaluate phi over an array of values, like:
phi([1,2,3,4]); %ERROR quad(@(L) besseli(1, (1+L)/(1-L)), 0, [1,2,3,4]); %ERROR
but these return errors. I could do this in a for loop, like:
nums=[1,2,3,4]; for(k=1:4) phi_eval = phi(nums(k)); end
but I was wondering if there was a better way to do things. Is there a no-for-loops way of doing this?
Christopher, I can't run the loop as well. But phi([1,2,3,4]) will certainly not work because the vector is being passed to quad directly as limits which is wrong syntax for quad.
You can try the following: