Numerical integration with array limits
Ältere Kommentare anzeigen
I'm trying to work with integrals that are functions of one of their limits:
For example,
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?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!