How can I calculate the moments of an exponential random variable
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone.
I am working in an aplication related to polynomial chaos expansions. For that, I need to calculate the analytic moments of the following random variable
pd = makedist('Exponential', 3)
t = truncate(pd,0,5)
rand_num=random(t, 100000000, 1);
However, I have no idea on how to do it. Can someone please give me a clue?
Best regards.
Jaime.
0 个评论
回答(1 个)
Torsten
2022-9-14
编辑:Torsten
2022-9-14
syms mu x lower upper n
assume(n,'integer')
assume(n>0)
lower = 0;
upper = 5;
mu = 3;
f = 1/mu*exp(-x/mu) / int(1/mu*exp(-x/mu),x,lower,upper)
fplot(f,[0 5])
%Check
int(f,x,lower,upper)
%Moments
moments = int(f*x^n,x,lower,upper)
2 个评论
Torsten
2022-9-14
Sure, you only need the PDF of the distribution and the fact that an analytical expression for the moments exists.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!