NaN (not a number) in numerical integration
Show older comments
I am trying to integrate the following expression over the variable alpha
ep=0.2;
u=0.2;
lam=0.7;
n=1000;
f=@(alpha) power((1-ep+ep*exp(u^(-1)*alpha)),n).*lam^(-1).*exp(-lam^(-1)*alpha);
out = quad(f,0,Inf)
When I try to solve this, I get NaN value. How can I solve this problem?
Thanks
2 Comments
Sulaymon Eshkabilov
on 3 Nov 2021
Could you ples show your equation written in math formulation format (not MATLAB embedded code)?
Muna Tageldin
on 3 Nov 2021
Accepted Answer
More Answers (1)
Looks like your function becomes infinite. Here's a plot zooming in where it happens
ep=0.2;
u=0.2;
lam=0.7;
n=1000;
f=@(alpha) power((1-ep+ep*exp(u.^(-1).*alpha)),n).*lam.^(-1).*exp(-lam.^(-1).*alpha);
out = quad(f,0,Inf)
a = 0.36:1.e-6:0.37;
figure
plot(a,f(a))
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
