Numerical integration Matlab plot

2 vues (au cours des 30 derniers jours)
Raj Patel
Raj Patel le 22 Sep 2020
Commenté : Ameer Hamza le 23 Sep 2020
The function which I want to integrate is:
fun = @(x) (1./(exp(0.00004781./(x))-1).*1./x.^4);
q = integral(fun,0,x1)
I want to make a semilogx plot of (q, x1) in matlab for values of x1 from 100*(10^(-9)) to 100*(10^(-6)). How can I do it using for loop?
Thanks in advance.
Raj Patel.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 22 Sep 2020
You can do it using arrayfun (similar to for-loop, but compact)
x1 = logspace(-9, -6, 10);
fun = @(x) (1./(exp(0.00004781./(x))-1).*1./x.^4);
y = arrayfun(@(x1_) integral(fun, 0, x1_), x1);
semilogx(x1, int_fun);
  2 commentaires
Raj Patel
Raj Patel le 22 Sep 2020
Thanks Ameer for your help. Appreciate your effort.
Ameer Hamza
Ameer Hamza le 23 Sep 2020
I am glad to be of help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Performance dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by