Numerical integration with array limits
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!