How can i get the mean of the function using symbolic maths in MATLAB

조회 수: 7 (최근 30일)
zahid
zahid 2017년 4월 26일
편집: Walter Roberson 2017년 4월 26일
i am interested to find the mean of the distribution but I am unable to get it.Could anybody help me to figure out where I am doing the mistake?
f=@(a,b,x)1./(x*b*sqrt(2*pi)).*exp(-((log(x)-a)./(sqrt(2)*b)).^2)
I am interested to find E(X) in symbolic form.
i know from the existing literature E(X)=exp(a+b^2/2) but i am not getting this answer. I am using the the function int(f,x,[0,inf]) by assuming that a is real value constant, b is greater and equal to zero.
Thanks

답변 (1개)

John D'Errico
John D'Errico 2017년 4월 26일
Note that if P(x) is a PDF on the domain [0,inf], then the expected value of the corresponding random variable is gotten from
int(P(x)*x,x,[0,inf])
To start with, it looks like you forgot to multiply by x.
A quick look at the PDF shows that you seem to be looking for the expected value of a lognormal distribution.
  댓글 수: 1
zahid
zahid 2017년 4월 26일
Thank you very much John D'Errico for answering this question i did this but i am getting the following answer int((2251799813685248*exp(-(a - log(x))^2/(2*b^2)))/(5644425081792261*b), x, 0, Inf) which is not the same as required. Could you please this why?

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by