integral with vectoric varying coeficient
Afficher commentaires plus anciens
Hello , i have a basic function
exp(-x.^2).*log(x).^2
which i integrate in a certain interval.
i want to multiply my basic function with a vectoric coefficient called coef_vec that varies with the interval.
so if the integral is at 5 my basic function whould be multiplied with coef_vec(5).
i know that its some how turning the integral into a loop.
Is it possible in matlab?
Thanks.
coef_vec=linspace(1,10,100)
fun = @(x)coef_vec*exp(-x.^2).*log(x).^2;
q = integral(fun,1,10);
Réponse acceptée
Plus de réponses (1)
David Hill
le 6 Mai 2020
Why not do it after computing the integral since it is a constant.
fun = @(x)coef_vec*exp(-x.^2).*log(x).^2;
q = integral(fun,1,10);
q=q*linspace(1,10,100);
1 commentaire
fima v
le 6 Mai 2020
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


